-
Notifications
You must be signed in to change notification settings - Fork 323
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
fix filter node drilldown for number columns #11572
base: develop
Are you sure you want to change the base?
Conversation
filterType: string | ||
} | ||
}> | ||
sortModel: ToValue<SortModel[]> | ||
isDisabled: ToValue<boolean> | ||
isFilterSortNodeEnabled: ToValue<boolean> | ||
createNodes: (...options: NodeCreationOptions[]) => void | ||
createNodes: (...options: NodeCreationOptions[]) => void, | ||
colTypeMap: Map<string, string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO mutable non-reactive data in a reactive API is a code smell. It avoids some unneeded reactivity overhead (usually for an event handler)--but it's only a half-measure: It requires the caller to eagerly keep the data up-to-date.
Rather than push data to event handlers, give them a way to pull it as needed--something like:
getColumnValueToEnso: (columnName) => ((columnValue: string) => Ast.Owned<Ast.Expression>)
Then in TableVisualization
, the colTypeMap
(that will be used internally by the getColumnValueToEnso
implementation) can be a computed
so that it is only constructed when an event handler needs the data.
@@ -605,6 +605,29 @@ watchEffect(() => { | |||
defaultColDef.value.sortable = !isTruncated.value | |||
}) | |||
|
|||
const colTypeMap = computed(() => { | |||
const colMap: Record<string, string> = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{}
is a bit hazardous as the basis for a map, because it isn't empty--it has properties like toString
. This can be avoided by using a Map
. (Alternatives would include constructing it with Object.create(null)
or querying it with Object.hasOwn
, but Map
expresses intent better).
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
TypeScript,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
or the Snowflake database integration, a run of the Extra Tests has been scheduled.