mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-19 13:21:46 +00:00
1ed00b67ad
H8: prefetched tiles and file blobs could be evicted under storage pressure (worsened by opaque tile responses inflating the quota ~7MB each), blanking the offline map right when a traveler needs it. Request persistent storage at app init so the browser exempts our caches from eviction. We deliberately keep tile requests no-cors (a cors switch would break self-hosted/custom tile providers without CORS headers), so persistence is the safe mitigation rather than de-opaquing responses. H9: Mapbox GL users had no offline map at all — no runtimeCaching matched the Mapbox hosts. Add a StaleWhileRevalidate rule for api.mapbox.com / *.tiles.mapbox.com so visited areas are available offline (best-effort; full pre-download still requires the Leaflet renderer, now documented). - new sync/persistentStorage.ts requestPersistentStorage(), called from main.tsx - vite.config: mapbox-tiles SW cache rule - MapViewAuto / tilePrefetcher comments document the offline-maps policy - tests for the persist helper (granted / already-persisted / absent / rejects)
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import React from 'react'
|
|
import ReactDOM from 'react-dom/client'
|
|
import { BrowserRouter } from 'react-router-dom'
|
|
import App from './App'
|
|
// Self-hosted Poppins (bundled, same-origin) so the app font can't be blocked by
|
|
// ad/tracker blockers the way the Google Fonts CDN can.
|
|
import '@fontsource/poppins/300.css'
|
|
import '@fontsource/poppins/400.css'
|
|
import '@fontsource/poppins/500.css'
|
|
import '@fontsource/poppins/600.css'
|
|
import '@fontsource/poppins/700.css'
|
|
// Geist Sans (self-hosted too) — used only for secondary "subtext" via --font-subtext.
|
|
import '@fontsource/geist-sans/400.css'
|
|
import '@fontsource/geist-sans/500.css'
|
|
import '@fontsource/geist-sans/600.css'
|
|
import './index.css'
|
|
import { startConnectivityProbe } from './sync/connectivity'
|
|
import { requestPersistentStorage } from './sync/persistentStorage'
|
|
|
|
startConnectivityProbe()
|
|
// Keep offline data (map tiles, file blobs, IndexedDB) exempt from eviction.
|
|
requestPersistentStorage()
|
|
|
|
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
<React.StrictMode>
|
|
<BrowserRouter>
|
|
<App />
|
|
</BrowserRouter>
|
|
</React.StrictMode>,
|
|
)
|