Only hydrate state from URL once in design section to avoid cycles

This commit is contained in:
Andrew Kingston 2021-04-07 15:10:03 +01:00
parent e897a5ae61
commit 799a5285e3
1 changed files with 7 additions and 0 deletions

View File

@ -18,6 +18,7 @@
let previousType let previousType
let previousAsset let previousAsset
let previousComponentId let previousComponentId
let hydrationComplete = false
// Hydrate state from URL params // Hydrate state from URL params
$: hydrateStateFromURL($params, $leftover) $: hydrateStateFromURL($params, $leftover)
@ -30,6 +31,12 @@
) )
const hydrateStateFromURL = (params, leftover) => { const hydrateStateFromURL = (params, leftover) => {
if (hydrationComplete) {
return
} else {
hydrationComplete = true
}
// Do nothing if no asset type, as that means we've left the page // Do nothing if no asset type, as that means we've left the page
if (!params.assetType) { if (!params.assetType) {
return return