Cycle detection with error display
Circular references are detected when a formula is committed or the graph is rebuilt. Every cell in the cycle shows #CYCLE!, and the cycle path is reported. Detection always terminates, so the engine cannot loop forever or overflow the stack.
Planned. This page shows the specification from issue #192. The live example, source for every framework and the API reference replace it when the feature ships.
Live example
A grid where A1 is 5, B1 is =A1*2 and C1 is =B1+1.
Expected behavior
Creating the cycle turns A1, B1 and C1 into #CYCLE!, and the panel shows 'A1 → C1 → B1 → A1'. Cells that depend on the cycle show #CYCLE! too. Breaking the cycle restores the numeric values.
Planned API surface
event: cycleDetected (path)method: formulaEngine.findCycles()option: formulas.cycleErrorValuecellClass: war-cell-error-cycleAcceptance criteria
- All cells in a strongly connected component display #CYCLE!. (pending)
- Downstream dependents propagate the error. (pending)
- The cycleDetected event fires with the ordered path. (pending)
- Detection over 100,000 nodes completes without recursion overflow because it uses an iterative algorithm. (pending)
- Self-reference (A1 is =A1) is detected. (pending)