-
Notifications
You must be signed in to change notification settings - Fork 0
Conditional enablement of 'Clear filters' button in Hypertable V2 #260
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
Changes from all commits
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 |
|---|---|---|
| @@ -1,17 +1,21 @@ | ||
| <div class="fx-row fx-malign-space-between"> | ||
| <div class="fx-row fx-gap-px-12"> | ||
| {{#if this.shouldDisplay}} | ||
| <OSS::Button | ||
| @skin="destructive" | ||
| @skin="default" | ||
| @label={{t "hypertable.column.remove"}} | ||
| {{on "click" this.removeColumn}} | ||
| class="fx-1" | ||
| data-control-name={{concat "hypertable__column_filtering_for_" @column.definition.key "_remove_column"}} | ||
| /> | ||
| {{else}} | ||
| <div class="fx-1"></div> | ||
| {{/if}} | ||
| <OSS::Button | ||
| @label={{t "hypertable.column.clear_filters"}} | ||
| {{on "click" this.reset}} | ||
| data-control-name={{concat "hypertable__column_filtering_for_" @column.definition.key "_clear_filters"}} | ||
| /> | ||
|
|
||
| {{#if this.displayClearButton}} | ||
| <OSS::Button | ||
| @skin="secondary" | ||
| @label={{t "hypertable.column.clear_filters"}} | ||
| class="fx-1" | ||
| {{on "click" this.reset}} | ||
| data-control-name={{concat "hypertable__column_filtering_for_" @column.definition.key "_clear_filters"}} | ||
| /> | ||
| {{/if}} | ||
| </div> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import Component from '@glimmer/component'; | ||
| import { tracked } from '@glimmer/tracking'; | ||
| import { action, set } from '@ember/object'; | ||
| import { action, computed, set } from '@ember/object'; | ||
| import { debounce, scheduleOnce } from '@ember/runloop'; | ||
| import { isEmpty } from '@ember/utils'; | ||
| import { htmlSafe } from '@ember/template'; | ||
|
|
@@ -63,6 +63,12 @@ export default class HyperTableV2 extends Component<HyperTableV2Args> { | |
| }; | ||
| } | ||
|
|
||
| @computed('args.handler.columns.@each.{filters,order}') | ||
| get displayResetButton(): boolean { | ||
| const filtersApplied: boolean = this.args.handler.columns.some((col) => col.filters?.length || col.order); | ||
| return filtersApplied && this.features.global_filters_reset; | ||
| } | ||
|
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. Bug: Reset Button Visibility InconsistencyThe |
||
|
|
||
| get displayHeader(): boolean { | ||
| return Object.keys(this.features).some((key) => this.features[key as keyof FeatureSet]); | ||
| } | ||
|
|
||
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.
Bug: Reactivity Issues in Glimmer Component Getter
The
displayClearButtongetter uses the@computeddecorator, which is not for Glimmer components and can lead to reactivity issues. Glimmer components rely on tracked properties. This, along with the'args.column.filters.[]'dependency potentially not tracking changes whenfiltersis initially undefined, may prevent the clear button from updating its display state correctly.