Skip to content

Commit 1d0a6c5

Browse files
committed
Updating so documents don't refresh cells and removed entities
1 parent 4497967 commit 1d0a6c5

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

frontend/src/components/kt/kt-controls/kt-resolved-entities.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ export function KtResolvedEntities(props: BoxProps) {
7272
...row,
7373
cells: Object.fromEntries(
7474
Object.entries(row.cells).map(([columnId, cellValue]) => {
75+
// Only modify cells in the source column or if it's a global rule
76+
if (entity.source.type === 'column' && columnId !== entity.source.id) {
77+
return [columnId, cellValue];
78+
}
79+
7580
if (typeof cellValue === 'string') {
7681
// Replace resolved with original in string values
7782
return [columnId, cellValue.includes(entity.resolved)

frontend/src/config/store/store.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -313,27 +313,26 @@ export const useStore = create<Store>()(
313313
// Get the set of row IDs being rerun
314314
const rerunRowIds = new Set(cells.map(cell => cell.rowId));
315315

316+
// Create a Set of cell keys being rerun for easy lookup
317+
const rerunCellKeys = new Set(
318+
cells.map(cell => `${cell.rowId}-${cell.columnId}`)
319+
);
320+
316321
// Only clear resolvedEntities for the specific cells being rerun
317322
editTable(activeTableId, {
318323
columns: columns.map(col => ({
319324
...col,
320-
resolvedEntities: rerunColumnIds.has(col.id)
321-
? (col.resolvedEntities || []).filter(entity => {
322-
// Keep entities that aren't from the rows being rerun
323-
if (entity.source.type === 'column') {
324-
const entityRowId = cells.find(cell =>
325-
cell.columnId === entity.source.id
326-
)?.rowId;
327-
return !entityRowId || !rerunRowIds.has(entityRowId);
328-
}
329-
return true;
330-
})
331-
: (col.resolvedEntities || [])
325+
resolvedEntities: (col.resolvedEntities || []).filter(entity => {
326+
// Keep entities that aren't from the cells being rerun
327+
const cellKey = `${entity.source.type === 'column' ? cells.find(cell =>
328+
cell.columnId === entity.source.id
329+
)?.rowId : ''}-${entity.source.id}`;
330+
return !rerunCellKeys.has(cellKey);
331+
})
332332
})),
333333
globalRules: globalRules.map(rule => ({
334334
...rule,
335335
resolvedEntities: (rule.resolvedEntities || []).filter(entity => {
336-
// Keep entities that aren't from the rows being rerun
337336
if (entity.source.type === 'global') {
338337
const affectedRows = cells.filter(cell =>
339338
rerunColumnIds.has(cell.columnId)

0 commit comments

Comments
 (0)