Skip to content

Commit d112b01

Browse files
committed
fix gameLoaded
1 parent 043e28e commit d112b01

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363

6464
if (window.navigator.maxTouchPoints > 1) window.location.hash = '#dev' // show eruda
6565
// unregister all sw
66-
if (window.navigator.serviceWorker) {
66+
if (window.navigator.serviceWorker && document.querySelector('.initial-loader').style.opacity !== 0) {
6767
console.log('got worker')
6868
window.navigator.serviceWorker.getRegistrations().then(registrations => {
6969
registrations.forEach(registration => {

src/appStatus.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { resetStateAfterDisconnect } from './browserfs'
12
import { hideModal, activeModalStack, showModal, miscUiState } from './globalState'
23
import { appStatusState, resetAppStatusState } from './react/AppStatusProvider'
34

@@ -25,13 +26,16 @@ export const setLoadingScreenStatus = function (status: string | undefined | nul
2526
}
2627
showModal({ reactType: 'app-status' })
2728
if (appStatusState.isError) {
28-
miscUiState.gameLoaded = false
2929
return
3030
}
3131
appStatusState.hideDots = hideDots
3232
appStatusState.isError = isError
3333
appStatusState.lastStatus = isError ? appStatusState.status : ''
3434
appStatusState.status = status
3535
appStatusState.minecraftJsonMessage = minecraftJsonMessage ?? null
36+
37+
if (isError && miscUiState.gameLoaded) {
38+
resetStateAfterDisconnect()
39+
}
3640
}
3741
globalThis.setLoadingScreenStatus = setLoadingScreenStatus

0 commit comments

Comments
 (0)