@@ -389,28 +389,19 @@ private extension StoreContext {
389389 dependency. _loader. performTransitiveUpdate ( subscription. update)
390390 }
391391
392- // Do not transitively update atoms that have dependency recorded not to update downstream.
393- // However, if the topological sorting has already skipped the vertex as a redundant,
394- // it should be performed.
395392 func convertToValidEdge( _ edge: Edge ) -> Edge ? {
393+ // Do not transitively update atoms that have dependency recorded not to update downstream.
396394 guard skippedDependencies. contains ( edge. from) else {
397395 return edge
398396 }
399397
400- guard let redundantDependencies = redundants [ edge. to] else {
398+ // If the topological sorting has marked the vertex as a redundant, the update still performed.
399+ guard let fromKey = redundants [ edge. to] ? . first ( where: { !skippedDependencies. contains ( $0) } ) else {
401400 return nil
402401 }
403402
404- // Topological sorting itself does not guarantee idempotent result when multiple
405- // dependencies update simultaneously and there's no valid update order to determine
406- // which atom triggered the transitive update, and thus here chooses a random
407- // dependency atom from redundant edges.
408- guard let fromKey = redundantDependencies. subtracting ( skippedDependencies) . first else {
409- return nil
410- }
411-
412- // Convert edge's `from`, which represents a dependency atom, to a non-skipped one on
413- // a best-effort basis to switch the update transaction context (e.g. animation).
403+ // Convert edge's `from`, which represents a dependency atom, to a non-skipped one to
404+ // change the update transaction context (e.g. animation).
414405 return Edge ( from: fromKey, to: edge. to)
415406 }
416407
0 commit comments