fix(table): prevent duplicate lazy load emission when filter on input - #1753
Open
faried-elrewany wants to merge 1 commit into
Open
faried-elrewany wants to merge 1 commit into
faried-elrewany wants to merge 1 commit into
Conversation
When <p-columnFilter> is configured with [filterOn]="'input'", typing triggers onModelChange() which immediately calls dataTable._filter(). Pressing Enter subsequently fired onTextInputEnterKeyDown or onNumericInputKeyDown, which unconditionally invoked dataTable._filter() a second time. Guarded both keydown handlers in ColumnFilterFormElement to skip _filter() when filterOn === 'input', preserving standard Enter key behavior when filterOn === 'enter'. Fixes openng-org#884
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When
<p-columnFilter>is configured with[filterOn]="'input'", typing triggersonModelChange(), which immediately callsdataTable._filter(). Pressing Enter subsequently firedonTextInputEnterKeyDownoronNumericInputKeyDown, which unconditionally invokeddataTable._filter()a second time, resulting in duplicateonLazyLoadevent emissions.Changes:
onTextInputEnterKeyDownandonNumericInputKeyDowninColumnFilterFormElementto bypass_filter()whenfilterOn === 'input'.filterOn === 'enter'.onLazyLoademission across text and numeric filters.Related issues
Fixes #884
Type of change
Breaking changes
None
Test plan
npm test(ranpnpm --filter @openng/optimus-ui test:unit- 3 new tests passed)npm run lint(npx eslintpassed with 0 errors)Checklist
Additional context
Prevents unnecessary backend network roundtrips triggered by duplicate
onLazyLoademissions on server-side paginated/filtered tables.