Skip to content

fix(popular-feed): refactor to correctly update window and refetch#379

Draft
paolomolo wants to merge 5 commits intodevelopfrom
fix/popular-feed-ranking
Draft

fix(popular-feed): refactor to correctly update window and refetch#379
paolomolo wants to merge 5 commits intodevelopfrom
fix/popular-feed-ranking

Conversation

@paolomolo
Copy link
Contributor

@paolomolo paolomolo commented Nov 24, 2025

  • 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.

  • Popular feed (hot):
    • Sync popularWindow with URL; on change, reset cache via removeQueries and force refetch with invalidateQueries for "popular-posts" keyed by window.
    • Expose isFetching as popularFetching and use it in initial loading/empty-state logic.
    • Enhance query function and list memoization with development-only debug logs; add safety effect on window changes.
    • Update handlePopularWindowChange to navigate with window, clear/invalidate queries, and fix hook dependencies.

Written by Cursor Bugbot for commit 08e2b9f. This will update automatically on new commits. Configure here.

- Update window correctly when refetching popular feed

- Fix refetch logic for popular feed
@netlify
Copy link

netlify bot commented Nov 24, 2025

Deploy Preview for fancy-gelato-7cdad5 ready!

Name Link
🔨 Latest commit 8f0701e
🔍 Latest deploy log https://app.netlify.com/projects/fancy-gelato-7cdad5/deploys/6924eb030e10360008a4151c
😎 Deploy Preview https://deploy-preview-379--fancy-gelato-7cdad5.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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
@paolomolo paolomolo marked this pull request as draft November 24, 2025 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant