@@ -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