fix: navigation blink root-caused — defer search-client.js (was parser-blocking mid-body), npm run demo serves the production build through the tunnel; DESIGN.md documents the VT removal + font-swap decision
This commit is contained in:
@@ -107,8 +107,13 @@ const links = [
|
||||
</details>
|
||||
</div>
|
||||
</header>
|
||||
<script is:inline src="/search-client.js"></script>
|
||||
<script is:inline>
|
||||
{/* Search enhancement is deferred — a synchronous script here would stall
|
||||
the parser mid-body on every navigation (blank below the header until
|
||||
it arrives). `defer` + the inline `type="module"` init join the same
|
||||
after-parse in-order queue (HTML spec), so newsSearch is defined first.
|
||||
The forms are plain GET /search, so nothing user-facing waits on JS. */}
|
||||
<script is:inline src="/search-client.js" defer></script>
|
||||
<script is:inline type="module">
|
||||
// Header search suggestions (desktop field + mobile reveal); the forms
|
||||
// are plain GET /search, so everything below is progressive enhancement.
|
||||
newsSearch({ input: 'hdr-q', list: 'hdr-suggest', status: 'hdr-suggest-status', limit: 6, unit: 'suggestion', dismiss: true });
|
||||
|
||||
@@ -24,8 +24,9 @@ import Base from '../layouts/Base.astro';
|
||||
</section>
|
||||
</Base>
|
||||
|
||||
{/* search-client.js is loaded once by the Base layout (header search) */}
|
||||
<script is:inline>
|
||||
{/* search-client.js is loaded once (deferred) by the Base layout; this inline
|
||||
module runs after it in the shared after-parse queue — order guaranteed. */}
|
||||
<script is:inline type="module">
|
||||
const run = newsSearch({ input: 'q', list: 'search-results', status: 'search-status', limit: 20, hint: 'Type at least 2 characters.' });
|
||||
// Support /search?q=… deep links (hero search form, footer, bookmarks)
|
||||
const q0 = new URLSearchParams(location.search).get('q');
|
||||
|
||||
Reference in New Issue
Block a user