Skip to content

Commit 1dd0434

Browse files
committed
improve comment
1 parent 8d6db4c commit 1dd0434

File tree

1 file changed

+9
-0
lines changed
  • turbopack/crates/turbo-tasks-backend/src/backend/operation

1 file changed

+9
-0
lines changed

turbopack/crates/turbo-tasks-backend/src/backend/operation/update_cell.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ impl UpdateCellOperation {
6464
// To avoid a race condition, we need to remove the old content first,
6565
// then invalidate dependent tasks and only then update the cell content.
6666

67+
// The reason behind this is that we consider tasks that haven't the dirty flag set
68+
// as "recomputing" tasks. Recomputing tasks won't invalidate
69+
// dependent tasks, when a cell is changed. This would cause missing invalidating if
70+
// a task is recomputing while a dependency is in the middle of a cell update (where
71+
// the value has been changed, but the dependent tasks have not be flagged dirty
72+
// yet). So to avoid that we first remove the cell content, invalidate all dependent
73+
// tasks and after that set the new cell content. When the cell content is unset,
74+
// readers will wait for it to be set via InProgressCell.
75+
6776
let old_content = task.remove(&CachedDataItemKey::CellData { cell });
6877

6978
drop(task);

0 commit comments

Comments
 (0)