fix: search empty state never renders for no-match queries (#126)#135
Conversation
Co-authored-by: Ona <no-reply@ona.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
✅ UI verification passed — design spec compliance confirmed. Static analysis: No violations found. All changed rendering conditions in Visual verification (production):
|
|
✅ Post-merge verification passed. E2E suite: 37/42 passed. The 5 failures are pre-existing editor test flakiness (strict mode violations from leftover content) — unrelated to this PR's search changes. Tracked in #140. Key result: The Ad-hoc smoke tests — all passed:
No routes skipped. Also closed #136 — both failures it tracked (search empty state, re-invite toast) now pass. |
Closes #126
What
After PR #123 added a
workspaceResolvedguard to the search debounce effect, the "No pages match your search" empty state stopped appearing for zero-result queries. The debounce effect's early return when!workspaceResolvedsetloading = truewithout starting a timer, and a race condition betweenworkspaceResolvedandsearchdependency changes could leaveloadingstuck attrue— preventing the empty-state condition (!loading && results.length === 0) from ever becoming true.How
Moved the
workspaceResolvedcheck from the debounce effect to the rendering layer. The debounce timer now always fires; thesearchcallback handlesworkspaceId === nullby clearing loading. The skeleton/empty-state rendering conditions useworkspaceResolveddirectly:loading || !workspaceResolved(preserves PR fix: flaky E2E tests for invite revocation and search (#118) #123's intent of not flashing "No pages match" while the workspace is still resolving)!loading && workspaceResolved && results.length === 0Also added a cleanup function to the workspace resolution effect to prevent stale callbacks in Strict Mode, and removed a redundant
setLoading(true)from thesearchcallback.Testing
page-search.test.tsx:pnpm test)pnpm test:e2e), including the previously failingsearch with no matches shows empty statepnpm lint && pnpm typecheckclean