fix: crash opening anew, can prevent some scripts from running the first time #481

Massimo Melina committed Apr 22, 2024 at 23:33 UTC 2c6e32128312f50177c5098be18706f80b3296ec
1 file changed +1 -2
shared/dialogs.ts
+1 -2
@@ -71,13 +71,12 @@ function back() {
71 }
72
73 ;(async () => {
74 - while (history.state.$dialog) { // it happens if the user reloads the browser leaving open dialogs
74 + while (history.state?.$dialog) { // it happens if the user reloads the browser leaving open dialogs
75 history.back()
76 await wait(1) // history.state is not changed without this, on chrome123
77 }
78 })()
79
80 -
80 export function Dialogs(props: HTMLAttributes<HTMLDivElement>) {
81 useEffect(() => domOn('popstate', () => {
82 if (ignorePopState)