fix(ui): only populate settings on main page
before, the init script was executed for every loaded iframe and was resetting `localStorage` everytime. It didn't show because the UI had its own copy of the settings via useState() - but now that it's reading directly from local storage, it shows. The fix is to ensure that the script isn't executed in iframes.
This commit is contained in:
parent
a83134b270
commit
e344c59630
|
|
@ -90,6 +90,8 @@ export async function syncLocalStorageWithSettings(page: Page, appName: string)
|
||||||
// iframes w/ snapshots, etc.
|
// iframes w/ snapshots, etc.
|
||||||
if (location && location.protocol === 'data:')
|
if (location && location.protocol === 'data:')
|
||||||
return;
|
return;
|
||||||
|
if (window.top !== window)
|
||||||
|
return;
|
||||||
Object.entries(settings).map(([k, v]) => localStorage[k] = v);
|
Object.entries(settings).map(([k, v]) => localStorage[k] = v);
|
||||||
(window as any).saveSettings = () => {
|
(window as any).saveSettings = () => {
|
||||||
(window as any)._saveSerializedSettings(JSON.stringify({ ...localStorage }));
|
(window as any)._saveSerializedSettings(JSON.stringify({ ...localStorage }));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue