fix(pwa): Ausstehendes needRefresh nicht mehr während des Renders setzen
Frühe Service-Worker-Callbacks puffern den Refresh-Status; der Flush erfolgt jetzt im useEffect statt in der Render-Phase. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -113,12 +113,14 @@ export function usePwaUpdate() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
setNeedRefreshRef.current = setNeedRefresh
|
setNeedRefreshRef.current = setNeedRefresh
|
||||||
if (pendingNeedRefreshRef.current !== null) {
|
|
||||||
setNeedRefresh(pendingNeedRefreshRef.current)
|
|
||||||
pendingNeedRefreshRef.current = null
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (pendingNeedRefreshRef.current !== null) {
|
||||||
|
const pending = pendingNeedRefreshRef.current
|
||||||
|
pendingNeedRefreshRef.current = null
|
||||||
|
setNeedRefresh(pending)
|
||||||
|
}
|
||||||
|
|
||||||
if (isUpdateSuppressed()) {
|
if (isUpdateSuppressed()) {
|
||||||
setNeedRefresh(false)
|
setNeedRefresh(false)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user