Prevent unnecessary URL param updates in design page
This commit is contained in:
parent
b1c292b79c
commit
a16ea4da09
|
@ -8,6 +8,11 @@
|
|||
|
||||
let initialised = false
|
||||
|
||||
// Cache previous values so we don't update the URL more than necessary
|
||||
let previousType
|
||||
let previousAsset
|
||||
let previousComponentId
|
||||
|
||||
// Hydrate state from query param on mount
|
||||
onMount(() => {
|
||||
const assetId = decodeURI($params.asset)
|
||||
|
@ -48,6 +53,19 @@
|
|||
return
|
||||
}
|
||||
|
||||
// Check we have different params than last invocation
|
||||
if (
|
||||
assetType === previousType &&
|
||||
asset === previousAsset &&
|
||||
componentId === previousComponentId
|
||||
) {
|
||||
return
|
||||
} else {
|
||||
previousType = assetType
|
||||
previousAsset = asset
|
||||
previousComponentId = componentId
|
||||
}
|
||||
|
||||
// Extract current URL params
|
||||
const currentParams = get(params)
|
||||
const currentLeftover = get(leftover)
|
||||
|
|
Loading…
Reference in New Issue