fix(gui): switching between tabs or closing tab performance issue

- Use a better approach to pass cell(td) element to attachment component

Signed-off-by: Pranav C <pranavxc@gmail.com>
This commit is contained in:
Pranav C
2023-04-03 21:48:57 +05:30
parent 9fbcae15a4
commit f23f454341
5 changed files with 7 additions and 46 deletions

View File

@@ -1,7 +1,5 @@
<script lang="ts" setup>
import { CellClickHookInj, createEventHook, onBeforeUnmount, onMounted, ref, useSmartsheetStoreOrThrow } from '#imports'
const { cellRefs } = useSmartsheetStoreOrThrow()
import { CellClickHookInj, CurrentCellInj, createEventHook, ref } from '#imports'
const el = ref<HTMLTableDataCellElement>()
@@ -9,16 +7,7 @@ const cellClickHook = createEventHook()
provide(CellClickHookInj, cellClickHook)
onMounted(() => {
cellRefs.value.push(el.value!)
})
onBeforeUnmount(() => {
const index = cellRefs.value.indexOf(el.value!)
if (index > -1) {
cellRefs.value.splice(index, 1)
}
})
provide(CurrentCellInj, el)
</script>
<template>