fix(popular-feed): refactor to correctly update window and refetch#379
Draft
fix(popular-feed): refactor to correctly update window and refetch#379
Conversation
- Update window correctly when refetching popular feed - Fix refetch logic for popular feed
✅ Deploy Preview for fancy-gelato-7cdad5 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
- Move useEffect hook that references popularData to after its declaration - Fixes 'Cannot access popularData before initialization' runtime error - useEffect now correctly placed after popularData query declaration
- Add isFetching to popular posts query destructuring - Update initialLoading to check both isLoading and isFetching - Fixes stuck skeleton loaders when query is fetching but isLoading is false - Ensures loading state is shown whenever query is actively fetching data
- Fix renderEmptyState to check for data pages before showing skeletons - Add fallback to render popularList directly if filteredAndSortedList is empty - Improve popularList computation to handle different response structures - Add debug logging to diagnose data structure issues - Ensures skeletons only show during actual loading, not when data exists
- Fix renderEmptyState to check for actual content before hiding skeletons - Always render feed content if popularList or filteredAndSortedList has items - Improve popularList extraction to handle different response structures - Filter out invalid items in popularList computation - Add comprehensive debug logging for data structure diagnosis - Skeletons now only show during actual loading, not when data exists
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update window correctly when refetching popular feed
Fix refetch logic for popular feed
Note
Ensure popular feed window updates reset cache and invalidate queries to refetch, incorporate fetching state into loading, and add targeted debug logs.
popularWindowwith URL; on change, reset cache viaremoveQueriesand force refetch withinvalidateQueriesfor"popular-posts"keyed bywindow.isFetchingaspopularFetchingand use it in initial loading/empty-state logic.handlePopularWindowChangeto navigate withwindow, clear/invalidate queries, and fix hook dependencies.Written by Cursor Bugbot for commit 08e2b9f. This will update automatically on new commits. Configure here.