fix: preserve search results during preference hydration - #3109
fix: preserve search results during preference hydration#3109anilloutombam wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughSummary by CodeRabbit
Walkthrough
Changesnpm search completion
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/composables/npm/useSearch.ts`:
- Around line 231-233: Update the pending-request branch in fetchMore within
app/composables/npm/useSearch.ts (lines 231-233) to call asyncData.refresh with
dedupe set to defer, ensuring it awaits the existing request rather than
replacing it. Add or update coverage in test/nuxt/composables/use-search.spec.ts
(lines 60-87) to verify fetchMore joins the in-flight request.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 5b5f5af6-f155-407e-8bd7-caf86263cdc4
📒 Files selected for processing (2)
app/composables/npm/useSearch.tstest/nuxt/composables/use-search.spec.ts
🔗 Linked issue
Fixes #2617
🧭 Context
When the page size was set to 50 or more, the first search could show no package results. Reloading the same search page made the results appear.
This happened because the saved page-size preference was loaded while the initial search was still running.
📚 Description
I changed fetchMore to wait for the initial search to finish before using its results. This prevents an empty response from being cached while the saved preference is loading.
I also added a regression test that reproduces this timing issue and checks that the package results are preserved.