wildcard icon indicating copy to clipboard operation
wildcard copied to clipboard

Add formulas back to Wildcard

Open geoffreylitt opened this issue 4 years ago • 0 comments

Previous versions of Wildcard before the big rewrite (2ef9898b) had formula evaluation built in. It hasn't been added in the new version yet.

In the old implementation, the core formula evaluation part was fine, but the integration with the UI was quite messy. The system started as a typical spreadsheet where you can edit a formula in any cell. But we quickly moved to a different model where a formula applies to a whole column at once. This was implemented with a hack: when the user would enter a formula into a cell, we would detect the formula and then propagate a copy of that formula to every cell in the column. Now that we've stabilized on the column-based model we should move the implementation to follow.

Rough Implementation strategy

  • store the formula on the column. persist in the localstorage user table so that formulas stick around; this is critical for allowing users to customize once and then use the customization many times.
  • perf strategy: when a row updates, re-eval all formulas in the row, but memoize formula evaluations within the evaluator (by input arg value). maybe don't bother even tracking dependencies yet. and don't persist memoization across page reloads. we can tweak this further if it gets slow, but it's not a priority yet.
  • store the results of formula evaluation in the redux table state, and join together in getfinalTable.

geoffreylitt avatar Nov 16 '20 20:11 geoffreylitt