fix props for panel (#6081)

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
Vyacheslav Tumanov 2024-07-17 11:29:09 +05:00 committed by GitHub
parent 2b3caf6283
commit 89417c7f84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,7 +21,14 @@
import notification, { DocNotifyContext, InboxNotification, notificationId } from '@hcengineering/notification'
import { BrowserNotificatator, InboxNotificationsClientImpl } from '@hcengineering/notification-resources'
import { IntlString, broadcastEvent, getMetadata, getResource } from '@hcengineering/platform'
import { ActionContext, ComponentExtensions, getClient, isAdminUser, reduceCalls } from '@hcengineering/presentation'
import {
ActionContext,
ComponentExtensions,
createQuery,
getClient,
isAdminUser,
reduceCalls
} from '@hcengineering/presentation'
import setting from '@hcengineering/setting'
import support, { SupportStatus, supportLink } from '@hcengineering/support'
import {
@ -406,6 +413,7 @@
const _class = props[2] as Ref<Class<Doc>>
const _id = await parseLinkId(linkProviders, props[1], _class)
const doc = await client.findOne<Doc>(_class, { _id })
panelDoc = { _class, _id }
if (doc !== undefined) {
const provider = ListSelectionProvider.Find(doc._id)
@ -428,6 +436,17 @@
closePanel(false)
}
}
let panelDoc: undefined | { _id: Ref<Doc>, _class: Ref<Class<Doc>> } = undefined
const panelQuery = createQuery()
$: if (panelDoc !== undefined) {
panelQuery.query(panelDoc._class, { _id: panelDoc._id }, (r) => {
if (r.length === 0) {
closePanel(false)
panelDoc = undefined
}
})
}
function clear (level: number): void {
switch (level) {