fix: skip client-side fuse re-filtering for async search results#13
Conversation
Groups with an async search() function have already performed server-side filtering. Re-running their results through Fuse.js (which defaults to matching only on 'label') incorrectly drops valid results when the search query matches non-label fields like email, booking number, or invoice recipient.
|
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 (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughUpdated the command bar search flow to run fuzzy-search only over sync commands derived from non- Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
@clack/core@1.1.0 (pulled by Nuxt examples) requires node:util.styleText which was added in Node 22.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/main.yml:
- Around line 11-12: The YAML steps list has incorrect indentation for the line
containing "uses: actions/checkout@v3" (it's over-indented by one space), which
breaks parsing; fix by aligning that entry with the other items in the same
steps list so all list entries (including "uses: actions/checkout@v3" and "uses:
pnpm/action-setup@v2") share the same indentation level under the steps key.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 581fb9bf-0b68-4221-a5ce-559fcdd783ee
📒 Files selected for processing (1)
.github/workflows/main.yml
Summary
search()function already perform server-side filtering, but their results were being re-filtered through Fuse.js (which defaults tokeys: ['label']). This caused valid results to be dropped when the search query matched non-label fields (e.g. email, booking number, invoice recipient).fuzzySearch()on sync commands (local/static groups). Async results are concatenated directly into the final result set without client-side re-filtering.The Problem
In
useCmdBarState.ts, thesearch()function:search()fn) and sync (static commands)group.search!(query)for async groups → gets server-filtered results ✅fuzzySearch()→ Fuse.js withkeys: ['label']❌Step 4 is wrong for async results. Example: searching
p.enis@gmail.comfor customers — the API correctly returns "Peter Enis", but Fuse.js tries to matchp.enis@gmail.comagainst the label "Peter Enis" and drops it.The Fix
Sync groups still get full Fuse.js fuzzy matching. Async groups trust their server-side search.
Summary by CodeRabbit