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

Fix Notes flash using local state #5469

Closed
wants to merge 2 commits into from
Closed

Conversation

H0onnn
Copy link
Contributor

@H0onnn H0onnn commented May 20, 2024

Issue

Work Detail

Modified the logic of useNotes hook using useState and useEffect.

  1. cashedNotes retains previously imported data. This allows existing data to remain visible while new data is imported.
  2. Once the data is finished loading, update cachedNotes with the latest data and set isLoading to false.

I believe this will prevent the UI from flickering, and it actually fixed the issue when I tested it on my local environment.

Tested in a slow 3G network.

Preview

2024-05-20.2.40.19.mov

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Pull Request Summary

  • Introduced local state management in the useNotes hook using useState and useEffect to cache notes and manage the loading state.
  • Retained previously loaded data in cachedNotes while new data is being fetched to prevent UI flickering.
  • Updated cachedNotes with the latest data once loading is complete and set isLoading to false.

Notes

  • This change should significantly improve the user experience by preventing flickering during data fetches.

@lucasbordeau
Copy link
Contributor

The bug seems to be fixed by some other change, closing this PR, thanks for your contribution @H0onnn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Notes flash after note update/creation
3 participants