Skip to content

add query params to jobs page #203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 12, 2025
Merged

Conversation

tracyyh
Copy link
Contributor

@tracyyh tracyyh commented Apr 11, 2025

Description

Makes it so when you navigate to the root, /, the link will update to have the id of the first role's id. If a role id is provided in the query param, the selectedRole is set to that query param.

Motivation and Context

Closes #189

How has this been tested?

Go to base url (/) and notice the query params append. Select another role and copy the URL. Open another tab and paste URL and hit enter. The selected role should match the one provided through the query params.

Screenshots (if appropriate):

Screenshot 2025-04-11 at 1 12 10 AM

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Database migration
    • Ran pnpm db:generate and verified generated SQL migration files in packages/db/drizzle

Checklist:

  • My code follows the code style of this project.
  • I have moved the ticket to "In Review"
  • I have added reviewers to this PR
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link

vercel bot commented Apr 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cooper ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 12, 2025 3:18am
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cooper-auth ⬜️ Skipped (Inspect) Apr 12, 2025 3:18am
cooper-docs ⬜️ Skipped (Inspect) Apr 12, 2025 3:18am

@vercel vercel bot temporarily deployed to Preview – cooper-docs April 11, 2025 05:15 Inactive
@vercel vercel bot temporarily deployed to Preview – cooper-auth April 11, 2025 05:15 Inactive
@tracyyh tracyyh marked this pull request as ready for review April 11, 2025 05:17
@tracyyh tracyyh requested review from banushi-a and Copilot April 11, 2025 05:17
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

apps/web/src/app/(pages)/(dashboard)/(roles)/page.tsx:63

  • [nitpick] Consider checking if the current URL already contains the same query parameter before calling router.replace to avoid redundant updates.
router.replace(`/?id=${selectedRole.id}`);

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

@vercel vercel bot temporarily deployed to Preview – cooper-auth April 12, 2025 03:17 Inactive
@vercel vercel bot temporarily deployed to Preview – cooper-docs April 12, 2025 03:17 Inactive
@tracyyh tracyyh requested a review from Copilot April 12, 2025 03:17
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Copy link
Contributor

@banushi-a banushi-a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lmk what you think we should do / what you wanna do

useEffect(() => {
// initializes the selectedRole to either the role provided by the query params or the first in the role data
if (defaultRole) {
setSelectedRole(defaultRole);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine for now, but in the future I think if we add a limit to the roles api, we will need to come up with a way to ensure that in case the api doesn't return the selected role, we still fetch it and show it to the user.

E.g. if the api returns like the top 30 ranked roles, but the user is trying to go to the link associated with the 50th ranked role, I don't think it will be selected. There are two things we can do in this case:
If the roleId is not in the list of roles:

  1. Fetch that single role from the api and add it to the list
  2. Redirect the user to the specific page for that role i.e. coopernu.vercel.com/role?id={id}

Copy link
Contributor

@banushi-a banushi-a Apr 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I just saw that if the supplied id isn't there you make it the first role which is good for now I think

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm yeah this is a good point, I think once we implement pagination for the roles we can relook at this since there'll be a page associated with it

@tracyyh tracyyh merged commit c95b5b5 into main Apr 12, 2025
9 checks passed
@tracyyh tracyyh deleted the append-query-params-to-jobs-page branch April 12, 2025 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(Develop) Roles Page Improved Role Selection
2 participants