File size: 2,268 Bytes
092334a
 
 
 
 
 
c920df3
4cfa2bb
092334a
4cfa2bb
 
 
092334a
4cfa2bb
 
c920df3
092334a
4cfa2bb
 
 
 
 
 
 
 
 
 
 
 
 
 
092334a
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App, { HOSTED } from './App.tsx'
import { installStandaloneBridge } from './customer-grid/apiBridge'
import { initializeHostBridge } from './customer-grid/hostBridge'
import { installActivityLog } from './settings/activityLog'
import { installEdgeRetry } from './net/edgeRetry'

// SDLC 67 close: this module body runs only once EVERY static chunk arrived, so this is the
// moment the index.html boot watchdog stops retrying (it reloads when a boot chunk 502s).
window.__aiosBootOk?.()
initializeHostBridge()
// Before the activity log, so the log wraps the retrying fetch and records final statuses.
installEdgeRetry()
installActivityLog()

// SDLC 67 close (2026-09-29): a stale HTML page requests a hashed chunk (`ribbon-*.css`, a lazy
// route) that no longer exists once a redeploy replaces it, OR the HF proxy's 502 land mid-chunk --
// either way Vite's runtime dispatches this event instead of letting the broken `import()` reject
// into an unhandled rejection, and the page is left blank ("Sheet could not be shown"). One reload
// picks up the new HTML with the new chunk map; the session-storage guard stops a genuinely broken
// deploy from reload-looping the tab forever.
window.addEventListener("vite:preloadError", event => {
  const KEY = "aios.preloadReloadedOnce"
  if (sessionStorage.getItem(KEY)) return
  try { sessionStorage.setItem(KEY, "1") } catch { /* private mode: reload once anyway */ }
  event.preventDefault()
  window.location.reload()
})

// EXIT wave 1 (X2): the standalone write path. THE ONE WIRING POINT — the embed
// bundle runs this file too, and the branch below is the whole of the wave's
// "standalone-only branches" promise. `HOSTED` is App.tsx's own constant, not a
// second copy of the predicate: a component-mode page must never register an
// HTTP sink for events that belong to the Streamlit value slot, and the two
// halves of that rule have to be reading the same answer. Ordered BEFORE render
// so the sink exists by the time the grid's first effect can emit.
if (!HOSTED) installStandaloneBridge()

createRoot(document.getElementById('root')!).render(
  <StrictMode>
    <App />
  </StrictMode>,
)