fix(react-db): let setWindow control limit/offset in useLiveInfiniteQuery#1553
fix(react-db): let setWindow control limit/offset in useLiveInfiniteQuery#1553v-anton wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR removes hardcoded ChangesuseLiveInfiniteQuery Window Control Fix
Sequence DiagramsequenceDiagram
participant UserComponent
participant useLiveInfiniteQuery
participant useLiveQuery
participant utils.setWindow
participant loadSubset
rect rgba(100, 150, 200, 0.5)
Note over useLiveInfiniteQuery: OLD: Hardcoded limit/offset
UserComponent->>useLiveInfiniteQuery: invoke hook
useLiveInfiniteQuery->>useLiveQuery: queryFn with .limit(pageSize+1).offset(0)
useLiveQuery->>loadSubset: fetch(limit, offset)
end
rect rgba(100, 200, 150, 0.5)
Note over useLiveInfiniteQuery: NEW: Dynamic window control
UserComponent->>useLiveInfiniteQuery: invoke hook
useLiveInfiniteQuery->>useLiveQuery: queryFn without initial window
useLiveInfiniteQuery->>utils.setWindow: setWindow(limit, offset)
utils.setWindow->>loadSubset: fetch with window constraints
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🎯 Changes
useLiveInfiniteQuerybaked.limit(pageSize + 1).offset(0)into the initial query builder. This capped results even aftersetWindow()tried to expand the window for subsequent pages, making pagination beyond page 1 return no additional data.The fix removes the hardcoded limit/offset from the initial query and lets
setWindow()(called in theuseEffectbelow) be the sole authority on the query window.✅ Checklist
pnpm test:pr.🚀 Release Impact
Summary by CodeRabbit
Bug Fixes