22 lines
724 B
TypeScript
22 lines
724 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 = async () => {
|
|||
|
|
if (root) return
|
|||
|
|
const host = document.createElement('div')
|
|||
|
|
host.id = 'app-update-root'
|
|||
|
|
document.body.appendChild(host)
|
|||
|
|
root = createRoot(host)
|
|||
|
|
root.render(<AppUpdateDialog />)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
export default mountAppUpdateDialog
|