Skip to content
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

Prevent user-guide content to flash on page change #5504

Closed
Bonapara opened this issue May 21, 2024 · 1 comment · Fixed by #5804
Closed

Prevent user-guide content to flash on page change #5504

Bonapara opened this issue May 21, 2024 · 1 comment · Fixed by #5804
Assignees
Labels
Next JS scope: front Issues that are affecting the frontend side only size: hours Website

Comments

@Bonapara
Copy link
Member

Current Behavior

There are three types of flashes occurring on the user-guide page transitions:

  1. Cover flash (Prevent user-guide page cover to flash on page load #5503)
  2. Table of content flash (0:13 on the video)
  3. Global flash (0:05 on the video)

The table of contents loads after the main content, causing a flash. Additionally, when re-clicking on an already opened article, the table of content flashes again. Occasionally, a global flash occurs, giving the impression that all content is reloading. These issues are demonstrated in the attached video.

CleanShot.2024-05-21.at.12.06.32.mp4

Desired Behavior

Flashes should be eliminated to ensure smooth transitions and loading of content on the page.

@Bonapara Bonapara added scope: front Issues that are affecting the frontend side only size: hours Next JS Website labels May 21, 2024
Copy link

greptile-apps bot commented May 21, 2024

Disclaimer: This comment was automatically generated with AI. It can give some useful hints as to where to look for, but sometimes it can also give very inaccurate answers so takes this with a pinch of salt :).

To address the flashes on the user-guide page transitions, follow these steps:

  1. UserGuideSidebar.tsx: Ensure the sidebar is preloaded and does not re-render unnecessarily.

  2. UserGuideTableContents.tsx: Preload the table of contents along with the main content. Use React's useEffect to fetch and set the table of contents state before rendering the main content.

  3. UserGuideContent.tsx: Optimize the content loading to prevent re-fetching data on re-clicking the same article. Implement caching mechanisms if necessary.

  4. page.tsx: Ensure that the global layout and styles are consistent and do not cause reflows or repaints. Use React's Suspense and lazy for code-splitting and loading components efficiently.

Example for preloading table of contents in UserGuideTableContents.tsx:

useEffect(() => {
  async function fetchData() {
    const data = await fetchTableOfContents();
    setTableOfContents(data);
  }
  fetchData();
}, []);

Review these components and optimize their rendering and data fetching strategies to eliminate the flashes.

References

FelixMalfait added a commit that referenced this issue Jun 11, 2024
- Fixes #5504
- Fixes #5503
- Return 404 when the page does not exist
- Modified the footer in order to align it properly
- Removed "noticed something to change" in each table of content
- Fixed the URLs of the edit module 
- Added the edit module to Developers
- Fixed header style on the REST API page.
- Edited the README to point to Developers
- Fixed selected state when clicking on sidebar elements

---------

Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Next JS scope: front Issues that are affecting the frontend side only size: hours Website
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants