Fix DataViews filter button flickering#71674
Conversation
Remove isShowingFilter from useEffect deps to break infinite re-render loop when toggling filters with locked filters present. Fixes WordPress#71672
oandregal
left a comment
There was a problem hiding this comment.
The current behavior is intentional: filters that are set as primary should always be visible, even if empty (no value set). See my comment at #71672 (comment)
Thanks for the feedback! I've implemented a fix that disables the filter toggle button when only primary or locked filters exist. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
This doesn't look great: Screen.Recording.2025-09-30.at.10.41.07.movGiven this only happens when all filters are either primary or locked (can't be hidden), I wonder if it'd be best to just hide the filter toggle in this scenario. |
|
@Adi-ty could you rebase in order to review? |

What?
Closes #71672
Clicking the filter button when locked filters are present causes flickering due to an infinite re-render loop.
Why?
The
useEffectthat auto-shows locked filters hadisShowingFilterin its dependency array, creating a loop.How?
Remove
isShowingFilterfrom the effect dependencies. The effect should only run whenhasPrimaryOrLockedFilterschanges, not when the user manually toggles filter visibility.Testing Instructions
Screenshots or screencast
Screen.Recording.2025-09-16.at.7.44.47.AM.mov
Screen.Recording.2025-09-16.at.7.40.21.AM.mov