-
Notifications
You must be signed in to change notification settings - Fork 4.6k
DataViews: open the filters from the column table consistently #72998
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
DataViews: open the filters from the column table consistently #72998
Conversation
|
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. |
| }, [ hasPrimaryOrLockedFilters, isShowingFilter ] ); | ||
|
|
||
| // Show filter panel when filters are added (but allow manual hiding). | ||
| const [ prevFiltersLength, setPrevFiltersLength ] = useState( |
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.
My instinct is that using a ref would be safer and more performant, seeing that setPrevFiltersLength won't be used in a different context. We can avoid rerenders and having prevFiltersLength in the dependency array, and then updating its value opens the door for infinite loops.
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.
This is now updated.
| currentFiltersLength > prevFiltersLengthRef.current && | ||
| ! isShowingFilter | ||
| ) { | ||
| setIsShowingFilter( true ); |
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.
I'm wondering if a better fix would be to just call this in table column header's add filter here. WDYT @oandregal ?
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.
Hi @ntsekouras, I tried that but setting explicitly there I thought was not better, even in filter's if you log the isShowingFilter, it is correctly showing the state, but only on initial filter check even it logs true, still it does not opens the filter panel.
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.
Yeah, updating the state in the table layout sounds better. Was there any issue with that approach, @hbhalodia ? I see the setIsShowingFilter function is already in the context, so available in the layout as well.
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.
The issue was not something with approach, We can set that explicitly in the column header, but my concern was, it was not working on first refresh, but thereafter it was working as expected, so updating the state in column header component wouldn't be a solution just to add a fix for this and explicitly adding to that component.
I can update the PR with tha approach (it was my first approach) but then thought of this, hence changed to that.
Updating the PR with the setting state via column header.
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.
Hi @oandregal, This is now updated, to use context within column-header.
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.
Hi @oandregal @ntsekouras, Can you please take a look on PR. Updated it with the required changes.
Thank You 🙇,
|
Thanks for working on this @hbhalodia |
What?
Closes #72986
Why?
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast
Screen.Recording.2025-11-05.at.4.06.44.PM.mov