Fix inbox rerender on delete (#6709)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina 2024-09-24 21:24:17 +04:00 committed by GitHub
parent b24027b2ea
commit f1da8ff9b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 3 deletions

View File

@ -28,7 +28,7 @@
export let lazy = false export let lazy = false
export let minHeight: string | null = null export let minHeight: string | null = null
export let highlightIndex: number | undefined = undefined export let highlightIndex: number | undefined = undefined
const getKey: (index: number) => string = (index) => index.toString() export let getKey: (index: number) => string = (index) => index.toString()
const refs: HTMLElement[] = [] const refs: HTMLElement[] = []

View File

@ -171,7 +171,8 @@
const [id, _class] = decodeObjectURI(loc?.loc.path[3] ?? '') const [id, _class] = decodeObjectURI(loc?.loc.path[3] ?? '')
const _id = await parseLinkId(linkProviders, id, _class) const _id = await parseLinkId(linkProviders, id, _class)
const context = _id ? $contextByDocStore.get(_id) : undefined const thread = loc?.loc.path[4] as Ref<ActivityMessage>
const context = $contextByDocStore.get(thread) ?? $contextByDocStore.get(_id)
selectedContextId = context?._id selectedContextId = context?._id
@ -180,7 +181,6 @@
} }
const selectedMessageId = loc?.loc.query?.message as Ref<ActivityMessage> | undefined const selectedMessageId = loc?.loc.query?.message as Ref<ActivityMessage> | undefined
const thread = loc?.loc.path[4] as Ref<ActivityMessage> | undefined
if (thread !== undefined) { if (thread !== undefined) {
const fn = await getResource(chunter.function.OpenThreadInSidebar) const fn = await getResource(chunter.function.OpenThreadInSidebar)

View File

@ -93,6 +93,11 @@
$: if (element != null) { $: if (element != null) {
element.focus() element.focus()
} }
function getContextKey (index: number): string {
const contextId = displayData[index][0]
return contextId ?? index.toString()
}
</script> </script>
<!-- svelte-ignore a11y-no-noninteractive-tabindex --> <!-- svelte-ignore a11y-no-noninteractive-tabindex -->
@ -108,6 +113,7 @@
kind="full-size" kind="full-size"
colorsSchema="lumia" colorsSchema="lumia"
lazy={true} lazy={true}
getKey={getContextKey}
> >
<svelte:fragment slot="item" let:item={itemIndex}> <svelte:fragment slot="item" let:item={itemIndex}>
{@const contextId = displayData[itemIndex][0]} {@const contextId = displayData[itemIndex][0]}