You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
diagram: editing an arrayed variable's equation turns it into a scalar #1094
In the web editor, changing the equation of an arrayed variable replaces the array with one scalar equation.
No message is shown.
Editing only its units or notes is safe.
Example
A project with a dimension Region (North, South) and an apply-to-all auxiliary price[Region] = 10.
Its details panel shows
{apply-to-all:}
10
Change 10 to 12 and click the canvas.
Expected: price[Region] = 12.
Actual: price is a scalar whose equation is {apply-to-all:}12.
A variable with an equation per element is worse.
The panel shows { TODO: arrayed variable editing isn't supported yet}, and typing one space saves that text as the variable's scalar equation and discards every element's equation.
Why it matters
The web editor is the main way people use Simlin, and this loses their work silently.
Undo recovers it only within the session.
We found it by reading the code and reproduced it with the real editor and engine in a test; we know of no user report.
Fix
Send the engine's setEquation patch operation, which changes the text and keeps the dimensions, instead of re-sending the whole variable.
The engine has it, with setElementEquation for one element; the TypeScript types do not list either yet.
A day or two.
Stopgap: make the equation field read-only for arrayed variables, about an hour.
Pointers
src/diagram/Editor.tsx: equationChangeOp clears arrayedEquation whenever the equation text changed
src/diagram/VariableDetails.tsx: scalarEquationFor builds the text the panel shows
Activity