-
Notifications
You must be signed in to change notification settings - Fork 6
Spreadsheet optimizations #4180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 8 commits
9203a40
51a6f08
cc5d140
d983f44
a1445bc
36132e6
0b68c1d
0284737
61e5729
f3a84d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,24 +24,26 @@ export const SPREADSHEET_INVALID_CELL_CLASS = 'spreadsheet-invalid-cell'; | |
|
|
||
| const createValueGetter = | ||
| (colDef: ColumnDefinition) => | ||
| (params: ValueGetterParams): CustomAggridValue | undefined => { | ||
| (params: ValueGetterParams): CustomAggridValue | null => { | ||
| try { | ||
| // Skip formula processing for pinned rows and use raw value | ||
| if (isCalculationRow(params.node?.data?.rowType)) { | ||
| return params.data[colDef.id]; | ||
| return params.data[colDef.id] ?? null; | ||
| } | ||
| const scope = { ...params.data }; | ||
| const colDependencies = colDef.dependencies ?? []; | ||
|
|
||
| //Empty values are assumed to be equal to "undefined" by users | ||
| colDependencies.forEach((dep) => { | ||
| scope[dep] = params.getValue(dep); | ||
| scope[dep] = params.getValue(dep) ?? undefined; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And why
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This undefined is crucial to keep existing formulas having this type of syntax "typeOf(IT10_Or) == 'undefined' ? IT10_Ex : typeOf(IT10_Ex) == 'undefined' ? IT10_Or : max(IT10_Or, IT10_Ex)" which are largely used in production.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay thanks, maybe update the comment to make it more explicit ? |
||
| }); | ||
| const result = limitedEvaluate(colDef.formula, scope); | ||
| return result == null ? undefined : validateFormulaResult(result, colDef.type); | ||
| const result = limitedEvaluate(colDef.formula, scope, params.context?.compiledFormulaCache); | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| return result != null ? validateFormulaResult(result, colDef.type) : null; | ||
| } catch (e) { | ||
| if (e instanceof MathJsValidationError) { | ||
| return { error: e.error }; | ||
| } | ||
| return undefined; | ||
| return null; | ||
| } | ||
| }; | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.