mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-02 17:32:50 +08:00
web: Discord-style stream grid, focus and pop-out window
Watched streams and our own broadcast are tiles in one grid (two columns in the corner), any tile can be enlarged across the grid, and the whole grid can move into its own browser window via a React portal; closing that window brings it back. main.tsx now reloads once when the App chunk (or a lazy chunk) fails to load, which is what left a black screen right after the last deploy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
1 parent
73ae268dfb
commit
8fbd591efa
5 files changed
+167
-16
No files matched your search
+30
-1
@@ -22,8 +22,37 @@ const root = createRoot(document.getElementById('root')!)
|
||||
|
||||
// App reads its stored identities/favorites while loading, so it's imported only after the vault is open
|
||||
// and the sync account (Options -> Konto) had its chance to bring in newer data.
|
||||
// After a deploy, a page (or the service worker cache) can still point at
|
||||
// chunk files that no longer exist, which used to leave a black screen. One
|
||||
// fresh load fixes that; the flag stops a reload loop if the server is broken.
|
||||
const RELOAD_FLAG = 'ws3-chunk-reload'
|
||||
function reloadOnceForStaleChunks(): boolean {
|
||||
try {
|
||||
if (sessionStorage.getItem(RELOAD_FLAG)) return false
|
||||
sessionStorage.setItem(RELOAD_FLAG, '1')
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
location.reload()
|
||||
return true
|
||||
}
|
||||
window.addEventListener('vite:preloadError', (event) => {
|
||||
if (reloadOnceForStaleChunks()) event.preventDefault()
|
||||
})
|
||||
|
||||
async function start() {
|
||||
const { default: App } = await import('./App.tsx')
|
||||
let App: typeof import('./App.tsx').default
|
||||
try {
|
||||
;({ default: App } = await import('./App.tsx'))
|
||||
} catch (error) {
|
||||
if (reloadOnceForStaleChunks()) return
|
||||
throw error
|
||||
}
|
||||
try {
|
||||
sessionStorage.removeItem(RELOAD_FLAG)
|
||||
} catch {
|
||||
// storage blocked - nothing to clear
|
||||
}
|
||||
startAutoSync()
|
||||
root.render(
|
||||
<StrictMode>
|
||||
|
||||
Reference in new issue
Block a user