19 lines
681 B
TypeScript
19 lines
681 B
TypeScript
import { createRoot, type Root } from 'react-dom/client'
|
||
import AppUpdateDialog from './AppUpdateDialog'
|
||
|
||
/**
|
||
* Güncelleme penceresi uygulama ağacından bağımsız, kendi kökünde mount edilir:
|
||
* - Entry chunk'ta taşınmaz (yalnızca güncelleme varken indirilir).
|
||
* - Router/Store yeniden render'larından etkilenmez, güncelleme sırasında
|
||
* uygulama yeniden yüklense bile pencere ayakta kalır.
|
||
*/
|
||
let root: Root | undefined
|
||
|
||
export const mountAppUpdateDialog = () => {
|
||
if (root) return
|
||
const host = document.createElement('div')
|
||
host.id = 'app-update-root'
|
||
document.body.appendChild(host)
|
||
root = createRoot(host)
|
||
root.render(<AppUpdateDialog />)
|
||
}
|