detached 9ae3e09

fix(homepage): unregister stale service workers before mount

commit
9ae3e09113a04e8e8cb52979953091840c9ec87a
author
bamen · · 2025-09-17 05:17 UTC
parent
e7ca981
signature
unsigned
2 files · +42 -8
M gui/src/pages/Homepage.svelte +20 -4
@@ -1,6 +1,6 @@
11 <script lang="ts">
22 import { onMount } from 'svelte';
3- import { Trash2, Globe } from '@lucide/svelte';
3+ // Icons disabled for investigation: removed @lucide/svelte imports
44
55 interface HistoryItem {
66 id: number;
@@ -478,11 +478,19 @@
478478 }}
479479 />
480480 <div class="history-favicon-fallback" style="display: none;">
481- <Globe size={12} />
481+ <!-- inline globe placeholder -->
482+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
483+ <circle cx="12" cy="12" r="10" />
484+ <path d="M2 12h20" />
485+ </svg>
482486 </div>
483487 {:else}
484488 <div class="history-favicon-fallback">
485- <Globe size={12} />
489+ <!-- inline globe placeholder -->
490+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
491+ <circle cx="12" cy="12" r="10" />
492+ <path d="M2 12h20" />
493+ </svg>
486494 </div>
487495 {/if}
488496 </div>
@@ -500,7 +508,8 @@
500508 onkeydown={(e) => e.key === 'Enter' && deleteHistoryEntry(item.id, e)}
501509 title="Delete this entry"
502510 >
503- <Trash2 size={16} />
511+ <!-- inline delete placeholder -->
512+ <span aria-hidden="true" style="display:inline-block;line-height:1;">×</span>
504513 </div>
505514 </div>
506515 </div>
@@ -588,6 +597,13 @@
588597 </div>
589598
590599 <style>
600+ /* Remove default browser margins/padding on the page */
601+ :global(html), :global(body) {
602+ margin: 0;
603+ padding: 0;
604+ background: #1a1a1a;
605+ }
606+
591607 /* Scoped homepage container to prevent global CSS conflicts */
592608 .homepage-container {
593609 font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
@@ -1,6 +1,6 @@
1 <script lang="ts">1 <script lang="ts">
2 import { onMount } from 'svelte';2 import { onMount } from 'svelte';
3- import { Trash2, Globe } from '@lucide/svelte';3+ // Icons disabled for investigation: removed @lucide/svelte imports
4 4
5 interface HistoryItem {5 interface HistoryItem {
6 id: number;6 id: number;
@@ -478,11 +478,19 @@
478 }}478 }}
479 />479 />
480 <div class="history-favicon-fallback" style="display: none;">480 <div class="history-favicon-fallback" style="display: none;">
481- <Globe size={12} />481+ <!-- inline globe placeholder -->
482+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
483+ <circle cx="12" cy="12" r="10" />
484+ <path d="M2 12h20" />
485+ </svg>
482 </div>486 </div>
483 {:else}487 {:else}
484 <div class="history-favicon-fallback">488 <div class="history-favicon-fallback">
485- <Globe size={12} />489+ <!-- inline globe placeholder -->
490+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
491+ <circle cx="12" cy="12" r="10" />
492+ <path d="M2 12h20" />
493+ </svg>
486 </div>494 </div>
487 {/if}495 {/if}
488 </div>496 </div>
@@ -500,7 +508,8 @@
500 onkeydown={(e) => e.key === 'Enter' && deleteHistoryEntry(item.id, e)}508 onkeydown={(e) => e.key === 'Enter' && deleteHistoryEntry(item.id, e)}
501 title="Delete this entry"509 title="Delete this entry"
502 >510 >
503- <Trash2 size={16} />511+ <!-- inline delete placeholder -->
512+ <span aria-hidden="true" style="display:inline-block;line-height:1;">×</span>
504 </div>513 </div>
505 </div>514 </div>
506 </div>515 </div>
@@ -588,6 +597,13 @@
588 </div>597 </div>
589 598
590 <style>599 <style>
600+ /* Remove default browser margins/padding on the page */
601+ :global(html), :global(body) {
602+ margin: 0;
603+ padding: 0;
604+ background: #1a1a1a;
605+ }
606+
591 /* Scoped homepage container to prevent global CSS conflicts */607 /* Scoped homepage container to prevent global CSS conflicts */
592 .homepage-container {608 .homepage-container {
593 font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;609 font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
M gui/src/pages/homepage.ts +22 -4
@@ -1,9 +1,27 @@
11 import { mount } from 'svelte';
22 import Homepage from './Homepage.svelte';
33
4+// Proactively unregister any Service Workers and clear caches that may have been
5+// installed by previous builds (e.g., SvelteKit), which can otherwise attempt to
6+// request non-existent _app/immutable/* assets under dumb://homepage.
7+async function cleanupServiceWorkersAndCaches() {
8+ try {
9+ if ('serviceWorker' in navigator) {
10+ const regs = await navigator.serviceWorker.getRegistrations();
11+ await Promise.all(regs.map((r) => r.unregister().catch(() => {})));
12+ }
13+ } catch { /* ignore */ }
14+
15+ try {
16+ if ('caches' in window) {
17+ const keys = await caches.keys();
18+ await Promise.all(keys.map((k) => caches.delete(k).catch(() => false)));
19+ }
20+ } catch { /* ignore */ }
21+}
22+
23+
424 // Mount the Homepage component to the DOM
5-const app = mount(Homepage, {
6- target: document.body,
25+cleanupServiceWorkersAndCaches().finally(() => {
26+ mount(Homepage, { target: document.body });
727 });
8-
9-export default app;⏎̸
@@ -1,9 +1,27 @@
1 import { mount } from 'svelte';1 import { mount } from 'svelte';
2 import Homepage from './Homepage.svelte';2 import Homepage from './Homepage.svelte';
3 3
4+// Proactively unregister any Service Workers and clear caches that may have been
5+// installed by previous builds (e.g., SvelteKit), which can otherwise attempt to
6+// request non-existent _app/immutable/* assets under dumb://homepage.
7+async function cleanupServiceWorkersAndCaches() {
8+ try {
9+ if ('serviceWorker' in navigator) {
10+ const regs = await navigator.serviceWorker.getRegistrations();
11+ await Promise.all(regs.map((r) => r.unregister().catch(() => {})));
12+ }
13+ } catch { /* ignore */ }
14+
15+ try {
16+ if ('caches' in window) {
17+ const keys = await caches.keys();
18+ await Promise.all(keys.map((k) => caches.delete(k).catch(() => false)));
19+ }
20+ } catch { /* ignore */ }
21+}
22+
23+
4 // Mount the Homepage component to the DOM24 // Mount the Homepage component to the DOM
5-const app = mount(Homepage, {25+cleanupServiceWorkersAndCaches().finally(() => {
6- target: document.body,26+ mount(Homepage, { target: document.body });
7 });27 });
8-
9-export default app;⏎̸

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close