DataTable: Empty "globalFilter" doesn't trigger onFilter on lazy mode #6773
Labels
Status: Needs Triage
Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Describe the bug
Hey guys, how are you doing?
I've been experiencing some issues when using
globalFilter
whenDataTable
is onlazy
mode.Whenever the value of
globalFilter
changes, theonFilter
is triggered, as expected.But when the value of
globalFilter
returns to a falsy value, theonFilter
is not triggered.I dunno if I'm doing something wrong, but the
onFilter
should trigger event when the value ofglobalFilter
is cleared, as it's returning to its initial state (kinda...).I'm afraid this can impact solutions done before, like #2777 which has been fixed in #2986.
Isn't the right approach to the
useUpdateEffect
to consider only if the value of theglobalFilter
is different thannull | undefined
?I don't know if I'm being stupid, but I'd like to understand if this is exaclty a bug or something.
Sorry for my english and thank you for the attention!
Reproducer
https://stackblitz.com/edit/vitejs-vite-vctmgs?file=src%2FApp.tsx
PrimeReact version
10.6.6
React version
18.x
Language
TypeScript
Build / Runtime
Create React App (CRA)
Browser(s)
Chrome
Steps to reproduce the behavior
globalFilter
.globalFilter
field and then remove the value.Expected behavior
The
onFilter
event should trigger when the valueglobalFilter
is an empty string.The text was updated successfully, but these errors were encountered: