-
Notifications
You must be signed in to change notification settings - Fork 2
Improve the speed of displaying instant feedback during navigation #330
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
Improve the speed of displaying instant feedback during navigation #330
Conversation
dc343d3 to
5ef4aa7
Compare
29d4726 to
e24bc9b
Compare
ff189c1 to
102868e
Compare
|
I've tested the recent changes and the loading bar integration into the secondary content looks great — nice work! The loading state in the secondary header is also a cool addition, but I noticed the placeholder content doesn't align perfectly with the loaded state. Check out the video below that compares both states. Specifically, it looks like we could adjust the following:
@mpabarca Do you think it's possible to have the two states match better? Matching these states more precisely would make the loading effect even more compelling! 🤗 video.mov |
This reverts commit 12a4dd9.
102868e to
f40cbcb
Compare
This comment was marked as outdated.
This comment was marked as outdated.
@simonbs
Good point, I didn't thought about a case with no edit section. Now I added a skeleton for the edit section by default. You can take a look how it looks in both cases Screen.Recording.2024-09-11.at.10.39.49.movScreen.Recording.2024-09-11.at.10.40.47.movUnless you have a better idea :) |
ab0a97d to
bebb033
Compare
That looks great! I think it's totally fine to optimize for the case where we have the edit button. |
simonbs
left a 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.
🚀✨🚀✨🚀✨🚀✨🚀✨🚀✨🚀
Reverting the approval until we've had a look at Ulrik's comment.
simonbs
left a 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.
🚀🔥👏🚀🔥👏🚀🔥👏
Description
Motivation and Context
Until now, the project has used different approaches to display a loading UI state when a user interacts with the site, such as navigating between pages, clicking buttons that perform specific actions, or fetching data for the Documentation Viewers (Swagger UI, Redocly, and Stoplight).
This PR introduces a built-in Next.js loading UI state to enhance navigation through the pages, specifically for the group route (home), which includes the /welcome, /new, and /[...slug] pages.
As we continue to experiment with achieving a fluid UI that provides instant feedback, smooth transitions, and consistent data, the following section will explain the rationale behind certain decisions.
Instant feedback when the user navigates through SSR pages for the first time
Note 1: The Loading state is an instant loading UI, based on Next.js documentation. It acts as a fallback to display while waiting for the full render of the page (found as loading.tsx).
Note 2: The delay in showing instant feedback for SSR pages (like the /new page) only occurs the first time the user navigates to that page. After that, previously fetched data from earlier renderings will be displayed immediately.
According to Next.js documentation, the loading state during navigation should appear immediately, so this delay shouldn’t be happening. This is where the concept of prefetching comes in. Prefetching essentially preloads the nearest parent loading.tsx to be shown in the group route. However, prefetching is not enabled in development mode.
So to verify that our loading state is working correctly, we need to run the application in production mode locally. You can do this by running npm run build to generate all new SSR files (pages, layouts, loading, etc.), and then npm run start. This will allow you to see prefetching in action, which should speed up the display of the loading state when navigating between pages.
Note 3: If you encounter the issue when running
npm run startthat says "[UntrustedHost]: Host must be trusted ..." this comes from using NextAuth. You need to update your.env(.local) file and add your host port. You can find more details here.👀 For more discussion on this specific topic, check out this issue on Vercel
Types of changes