Skip to content
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

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

marthasharkey
Copy link
Contributor

@marthasharkey marthasharkey commented Nov 15, 2024

number-filter-drilldown-fix

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.
  • If meaningful changes were made to logic or tests affecting Enso Cloud integration in the libraries,
    or the Snowflake database integration, a run of the Extra Tests has been scheduled.
    • If applicable, it is suggested to paste a link to a successful run of the Extra Tests.

filterType: string
}
}>
sortModel: ToValue<SortModel[]>
isDisabled: ToValue<boolean>
isFilterSortNodeEnabled: ToValue<boolean>
createNodes: (...options: NodeCreationOptions[]) => void
createNodes: (...options: NodeCreationOptions[]) => void,
colTypeMap: Map<string, string>
Copy link
Contributor

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.

@marthasharkey marthasharkey marked this pull request as ready for review November 19, 2024 10:00
@marthasharkey marthasharkey added the CI: No changelog needed Do not require a changelog entry for this PR. label Nov 19, 2024
@@ -605,6 +605,29 @@ watchEffect(() => {
defaultColDef.value.sortable = !isTruncated.value
})

const colTypeMap = computed(() => {
const colMap: Record<string, string> = {}
Copy link
Contributor

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants