fix(campaigns): remove server prefetch causing refetch loop on every navigation - #33
Open
Rishavraaj wants to merge 1 commit into
Open
fix(campaigns): remove server prefetch causing refetch loop on every navigation#33Rishavraaj wants to merge 1 commit into
Rishavraaj wants to merge 1 commit into
Conversation
…navigation force-dynamic made the server component re-run on every client-side navigation. The server only prefetched page 1, HydrationBoundary then overwrote the client's multi-page cache, and the IntersectionObserver cascade re-fetched all pages again — every navigation. Client now manages all fetching via useInfiniteQuery with staleTime: 5min. First visit cascades pages; subsequent visits within 5 min use the cache. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
force-dynamicand server-sideprefetchInfiniteQueryfrom the campaigns list pageuseInfiniteQuerywithstaleTime: 5minRoot Cause
force-dynamicmade the server component re-run on every client-side navigation (not just hard refresh). On each visit:HydrationBoundaryoverwrote the client's multi-page cache with just page 1IntersectionObservercascade re-fetched all pages from scratch — againThis caused repeated Apollo API calls every time the user navigated to
/campaigns.Changes
apps/web/src/app/(app)/campaigns/page.tsx— removedforce-dynamic, server prefetch, andHydrationBoundary; page is now a simple client-rendered componentTest plan
/campaigns— sequences load (cascade fetches all pages once)/api/integrations/apollo/sequences(client cache used)🤖 Generated with Claude Code