Fix JS crashing if initial-state is not set (#2193)
Fixes issues with the JS for at least sign-up pages not workingpull/2194/head
parent
2ebbfebfe9
commit
5b58ebb04f
|
@ -96,11 +96,13 @@ const element = document.getElementById('initial-state');
|
||||||
const initialState = element?.textContent && JSON.parse(element.textContent);
|
const initialState = element?.textContent && JSON.parse(element.textContent);
|
||||||
|
|
||||||
// Glitch-soc-specific “local settings”
|
// Glitch-soc-specific “local settings”
|
||||||
|
if (initialState) {
|
||||||
try {
|
try {
|
||||||
initialState.local_settings = JSON.parse(localStorage.getItem('mastodon-settings'));
|
initialState.local_settings = JSON.parse(localStorage.getItem('mastodon-settings'));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
initialState.local_settings = {};
|
initialState.local_settings = {};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {keyof InitialStateMeta} K
|
* @template {keyof InitialStateMeta} K
|
||||||
|
|
Loading…
Reference in New Issue