Improve search #42
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
On the frontend, doing Ctrl + K searches for notes. Upgrade the search and make that it also searches everywhere, for actors, items and also maps
Now let me look at an existing test that inspects component behavior (not just styles), to follow the testing conventions:
Everything checks out. Now I'll rewrite
TopSearchBar.vueto search notes, actors, items, and maps — opening each the same way the sidebar does:SearchResult.vuehas a potential bug that is now on the click path of all results:handleSelectreferencesprops, but the return value ofdefinePropsis never assigned — clicking on any result will throw an exception. Let me make a minimal fix:Now the test, following the repo's source-reading test conventions:
All 113 tests pass. Let me confirm the new tests specifically ran and the frontend still builds:
No package manager or installed deps here (CI runs only
node --testwithout installing), so I can't run a full Nuxt build. I'll at least syntax-check the extracted<script setup>blocks:All good. Final review of the change set:
Done. The Ctrl+K palette now searches the whole campaign, not just notes.
Changes
frontend/app/components/viewer/topbar/TopSearchBar.vue— the search itself:/note/all(so notes nested in folders are searchable too, not just root notes),/actor/list,/item/list,/map/list— fetched in parallel, each failure-isolated.ActionRegistry.search.book/user/box/mapicons,campaigns.sections.*i18n keys — already present in en/es/ca).openResultdispatcher) opens it exactly the way the sidebar does:push-notewith its content (retrieved via/note/retrieve/:id, fixing notes that opened empty from search);character_sheetwindow;item_sheetwindow;map_viewerfirst);frontend/app/components/viewer/topbar/SearchResult.vue— one-word adjacent fix:handleSelectreferenced an unassignedprops, so clicking any result threw; nowconst props = defineProps(...).tests/search-everywhere.test.js(new) — 5 tests in the repo's source-reading style covering the four fetched lists, the per-type matching, the sidebar-equivalent open behavior, the shared Enter/click dispatcher, and per-type icons/labels (verifying the section labels exist in all three locales).Verification
npm testat the repo root: 113/113 pass (including the 5 new ones).<script setup>blocks of both components passnode --check. A full Nuxt build/dev run wasn't possible in this environment (no package manager / installed deps; the test workflow also runs dependency-free).Implementation is ready for review: #45