mirror of
https://github.com/hcengineering/platform.git
synced 2025-01-22 19:38:17 +00:00
load view options from old key when there is no new one
Signed-off-by: Nikolay Chunosov <Chunosov.N@gmail.com>
This commit is contained in:
parent
e676b75e7f
commit
d7768adea2
@ -31,8 +31,11 @@ export function isDropdownType (viewOption: ViewOptionModel): viewOption is Drop
|
|||||||
return viewOption.type === 'dropdown'
|
return viewOption.type === 'dropdown'
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeViewOptionsKey (viewlet: Viewlet, variant?: string): string {
|
function makeViewOptionsKey (viewlet: Viewlet, variant?: string, ignoreViewletKey = false): string {
|
||||||
const prefix = viewlet.viewOptions?.storageKey ?? viewlet._id + (variant !== undefined ? `-${variant}` : '')
|
const prefix =
|
||||||
|
viewlet.viewOptions?.storageKey !== undefined && !ignoreViewletKey
|
||||||
|
? viewlet.viewOptions.storageKey
|
||||||
|
: viewlet._id + (variant !== undefined ? `-${variant}` : '')
|
||||||
const loc = getCurrentResolvedLocation()
|
const loc = getCurrentResolvedLocation()
|
||||||
loc.fragment = undefined
|
loc.fragment = undefined
|
||||||
loc.query = undefined
|
loc.query = undefined
|
||||||
@ -57,8 +60,14 @@ function _getViewOptions (viewlet: Viewlet, viewOptionStore: Map<string, ViewOpt
|
|||||||
if (store !== undefined) {
|
if (store !== undefined) {
|
||||||
return store
|
return store
|
||||||
}
|
}
|
||||||
const options = localStorage.getItem(key)
|
let options = localStorage.getItem(key)
|
||||||
if (options === null) return null
|
if (options === null) {
|
||||||
|
const key = makeViewOptionsKey(viewlet, viewlet.variant, true)
|
||||||
|
options = localStorage.getItem(key)
|
||||||
|
if (options === null) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
const res = JSON.parse(options)
|
const res = JSON.parse(options)
|
||||||
setStore(key, res)
|
setStore(key, res)
|
||||||
return res
|
return res
|
||||||
|
Loading…
Reference in New Issue
Block a user