UBER-646: clear the class when view is changed to prevent using old one (#3541)

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
Vyacheslav Tumanov 2023-08-01 17:40:40 +05:00 committed by GitHub
parent 315d20480b
commit 3c376696f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -21,6 +21,7 @@
import view from '../../plugin'
import FilterTypePopup from './FilterTypePopup.svelte'
import IconClose from '../icons/Close.svelte'
import { onDestroy } from 'svelte'
export let _class: Ref<Class<Doc>> | undefined
export let space: Ref<Space> | undefined = undefined
@ -51,6 +52,10 @@
if (e !== undefined) setFilters([e])
}
onDestroy(() => {
_class = undefined
})
function add (e: MouseEvent) {
const target = eventToHTMLElement(e)
showPopup(

View File

@ -110,7 +110,6 @@
query: fv.location.query ?? undefined,
fragment: fv.location.fragment ?? undefined
})
setFilters(JSON.parse(fv.filters))
if (fv.viewletId !== undefined && fv.viewletId !== null) {
const viewlet = await client.findOne(view.class.Viewlet, { _id: fv.viewletId })
setActiveViewletId(fv.viewletId, fv.location)
@ -118,6 +117,7 @@
setViewOptions(viewlet, copy(fv.viewOptions))
}
}
setFilters(JSON.parse(fv.filters))
}
const clearSelection = () => {