File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -303,6 +303,15 @@ void IRemoteTableHandle.Apply(IEventContext context, MultiDictionaryDelta<object
303
303
// This is a local operation -- it only looks at our indices and doesn't invoke user code.
304
304
// So we don't need to wait for other tables to be updated to do it.
305
305
// (And we need to do it before any PostApply is called.)
306
+ // Reminder: We need to loop through the removed entries to delete them prior to inserting the new entries,
307
+ // in order to avoid keys an error with the same key already added.
308
+ foreach ( var ( _, value ) in wasRemoved )
309
+ {
310
+ if ( value is Row oldRow )
311
+ {
312
+ OnInternalDeleteHandler . Invoke ( oldRow ) ;
313
+ }
314
+ }
306
315
foreach ( var ( _, value ) in wasInserted )
307
316
{
308
317
if ( value is Row newRow )
@@ -335,14 +344,6 @@ void IRemoteTableHandle.Apply(IEventContext context, MultiDictionaryDelta<object
335
344
throw new Exception ( $ "Invalid row type for table { RemoteTableName } : { newValue . GetType ( ) . Name } ") ;
336
345
}
337
346
}
338
-
339
- foreach ( var ( _, value ) in wasRemoved )
340
- {
341
- if ( value is Row oldRow )
342
- {
343
- OnInternalDeleteHandler . Invoke ( oldRow ) ;
344
- }
345
- }
346
347
}
347
348
348
349
void IRemoteTableHandle . PostApply ( IEventContext context )
You can’t perform that action at this time.
0 commit comments