diff --git a/apps/frontend/src/lib/components/blocks/grid-view/editable-cell/reference-cell.svelte b/apps/frontend/src/lib/components/blocks/grid-view/editable-cell/reference-cell.svelte index 1dd2aa1d6..1e0a64d5a 100644 --- a/apps/frontend/src/lib/components/blocks/grid-view/editable-cell/reference-cell.svelte +++ b/apps/frontend/src/lib/components/blocks/grid-view/editable-cell/reference-cell.svelte @@ -2,12 +2,17 @@ import type { ReferenceField } from "@undb/table" import ForeignRecordsPickerDropdown from "../../reference/foreign-records-picker-dropdown.svelte" import { Button } from "$lib/components/ui/button" - import { writable, type Writable } from "svelte/store" + import { writable, type Readable, type Writable } from "svelte/store" + import { getRecordsStore } from "$lib/store/records.store" + import { getTable } from "$lib/store/table.store" + + const table = getTable() export let tableId: string export let field: ReferenceField export let value: string[] = [] export let displayValue: string[] + export let viewId: Readable export let isEditing: boolean export let isSelected: boolean export let recordId: string @@ -24,6 +29,12 @@ $: if (hasValue && !hasValueReactive) { hasValue = hasValueReactive } + + const recordStore = getRecordsStore() + + function onSuccess(id: string) { + recordStore.invalidateRecord($table, id, $viewId) + }
@@ -36,6 +47,7 @@ hasValue = hasValueReactive } }} + {onValueChange} {field} {tableId} {recordId} @@ -43,6 +55,7 @@ bind:isSelected={hasValue} bind:selected let:builder + {onSuccess} > {#if hasValueReactive}