Repository navigation
fix(search): bring Site search back with Back as the visitor left it - #1707
Merged
gregpriday merged 8 commits intoNov 28, 2026
Merged
gregpriday merged 8 commits into
gregpriday merged 8 commits into
Conversation
- a root-layout snapshot keeps every Site search on the page, told apart by its order, for each history entry - each search hands back its box's words and the results of its last search, or searches again for one that had not finished - refresh the Foundation pack digests
…helper import-free - the layout hands keptSearches to SvelteKit's snapshot(), so pages that show a search need nothing from $app/navigation - test the layout wiring and stub snapshot() in the generated-site harness
- a search not showing when its entry comes back never hands its words to another, and takes its own back once it shows - test the kept list showing at once, an empty search, and a search that shows later
- drop the late claim, which could hand an entry's search to the next page or replace a restored search with the address's ?q= - a search not showing as its entry returns starts afresh
gregpriday
force-pushed
the
feature/issue-1436-restore-the-published-search-query-and
branch
from
November 28, 2026 10:29
6a22d84 to
f9e5515
Compare
…-restore-the-published-search-query-and
Member
Author
|
CI on 46a6b5b failed in three files, none of them reached by this change:
The Site search tests ( |
gregpriday
deleted the
feature/issue-1436-restore-the-published-search-query-and
branch
November 28, 2026 11:21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Same-tab Back from a Site search result now brings the search back as the visitor left it: the words in the box and the result list, ready to open another match.
Resolves #1436
Changes
search-history.js(shipped with every site): one SvelteKitsnapshot()registration (keptSearches) holds every search on the page for each history entry, in memory and in the tab's session storage, never in the address. Each search is known by its region (header, footer, page), its name and label, and its order among searches alike, so a header search and a page search each get their own state back. A search that isn't showing when its entry returns never inherits another's words, and starts afresh when it shows.snapshot(keptSearches). The helper itself imports nothing, so pages that render a search without the layout (the editor's component previews and the test harnesses) need nothing from$app/navigation.site.searchcaptures{ query, sent, status, found }and restores finished results synchronously, with no new search. A search that hadn't finished (or had failed) runs again, an empty search shows its hint again, and a cleared search stays cleared. A?q=search that is still in flight is dropped once the restore lands.resources/packs/foundation/pack.jsonandresources/packs-dev/foundation-alt/pack.jsonare edited in place, with their digests refreshed inresources/packs.lock.json, following the earlierfix(foundation)commits.Follow-up required: the same
site.searchchange needs to land insiteorigin/builder-components. The lock still names the earlier builder-components commit, so anpm run build:packsfrom that checkout would revert this fix.Testing
tests/unit/site-search-visitor.test.ts(headless Chromium): Back from a result restores the query, status and result link, and the list is present as soon as the search mounts. Also covered: a cleared search stays cleared, an empty search keeps its hint, two searches each get their own state (including words typed after the last search), a search hidden on return never takes another's state and starts afresh when it shows, and a persistent search comes back after its path reset. The$app/navigationstub models Kit's per-entry snapshot through session storage. The three Back cases fail on the old component.tests/unit/generator.test.ts: the layout imports and callssnapshot(keptSearches)in the export and the preview, and the helper has no imports.tests/unit/generated-site.ts: the no-navigation stub gainssnapshot.container-queries-browser.test.ts› webkit "keeps a sticky query container stuck while its row scrolls by". That test fails ondeveloptoo (base-level).npm run typecheck:changedgreen. The repo has no lint or format step.