-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this 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}`);
There was a problem hiding this 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.
There was a problem hiding this 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.
There was a problem hiding this 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); |
There was a problem hiding this comment.
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:
- Fetch that single role from the api and add it to the list
- Redirect the user to the specific page for that role i.e.
coopernu.vercel.com/role?id={id}
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
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):
Types of changes
pnpm db:generate
and verified generated SQL migration files inpackages/db/drizzle
Checklist: