-
Notifications
You must be signed in to change notification settings - Fork 29
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
fix(lib-user): use next/link for internal app routes #6379
base: master
Are you sure you want to change the base?
Conversation
af9eb9c
to
fc363d1
Compare
@@ -291,7 +292,7 @@ function MainContent({ | |||
margin={{ top: 'small' }} | |||
> | |||
<StyledCertificateButton | |||
forwardedAs='a' | |||
forwardedAs={Link} |
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.
Noting here that forwardedAs='a'
does nothing on a Grommet Button. Grommet automatically renders Button as a link, if it has a href
attribute.
I agree with these changes, but just a heads up that full review won't take place until next week. There are changes to AFD cache rules and actions to purge AFD going into place during FEM deploy tomorrow, so I just want to isolate the changes to prefetching in this PR for deploy the next time instead. I included the bump in lib-user's peer dependency for Next.js in #6367. |
Use `next/link` for the home page link to user stats, and the link to your stats certificate. Also fix the `lib-user` peer dependencies, which were still requiring Next.js 13.5.
fc363d1
to
4ff419a
Compare
Sounds good. Here's a quick screen recording to show the instantaneous transitions between page views on this branch, once the initial data load is complete. Screen.Recording.2024-10-17.at.09.10.29.mov |
Use
next/link
for the home page link to user stats, the link to your stats certificate, and the Back link at the top of each page.Also fix the
lib-user
peer dependencies, which were still requiring Next.js 13.5.Please request review from
@zooniverse/frontend
team or an individual member of that team.Package
Linked Issue and/or Talk Post
How to Review
'More stats', on the home page, and 'View certificate', on the user stats page, and the Back link on each of those pages, should now use client-side routing in the root Next.js app.
Build the user library with these changes, then build and run the root app with
yarn build && yarn start
, to verify that those links are now using client-side routing (ie. the page doesn't reload, andapp-root
doesn't unmount and remount in the browser, when moving between views.)This should also lower the load on the Next.js app server, since it doesn't have to serve the whole app on every page transition. Locally, you'll probably see that as faster page transitions with a production build.
NB. Next.js development mode disables client-side routing, so I don't think this PR can be checked with
yarn dev
.Checklist
PR Creator - Please cater the checklist to fit the review needed for your code changes.
PR Reviewer - Use the checklist during your review. Each point should be checkmarked or discussed before PR approval.
General
yarn panic && yarn bootstrap
ordocker-compose up --build
and FEM works as expectedGeneral UX
Example Staging Project: i-fancy-cats
Bug Fix