Skip to content

Commit 766bf59

Browse files
committed
Simplify beforeunload handler
Remove unnecessary comments and custom message strings. The handler now simply triggers the browser's confirmation dialog for temporary sites.
1 parent c1e4cb6 commit 766bf59

File tree

1 file changed

+6
-7
lines changed
  • packages/playground/website/src/lib/state/redux

1 file changed

+6
-7
lines changed

packages/playground/website/src/lib/state/redux/slice-ui.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,15 @@ export const browserConfirmationMiddleware: Middleware =
137137
const state = store.getState() as any;
138138
// Access the active site directly from state structure
139139
const activeSiteSlug = state.ui?.activeSite?.slug;
140-
const activeSite = activeSiteSlug ? state.sites?.entities?.[activeSiteSlug] : undefined;
141-
140+
const activeSite = activeSiteSlug
141+
? state.sites?.entities?.[activeSiteSlug]
142+
: undefined;
143+
142144
// Only show confirmation for temporary sites (storage === 'none')
143145
if (activeSite && activeSite.metadata?.storage === 'none') {
144-
const message = 'Your changes will be lost. This is a temporary Playground site. Are you sure you want to leave?';
145146
e.preventDefault();
146-
// Modern browsers require setting returnValue
147-
e.returnValue = message;
148-
// Some older browsers use the return value
149-
return message;
147+
e.returnValue = '';
148+
return '';
150149
}
151150
});
152151
}

0 commit comments

Comments
 (0)