feat: Enhance tab state management with query arguments and localStorage fallback#3143
feat: Enhance tab state management with query arguments and localStorage fallback#3143
Conversation
|
@josephfusco we should add an e2e test for this. The Codeception tests don't run JavaScript in the client, so we'd need to add a PlayWright test, similar to this one: https://github.com/wp-graphql/wp-graphql/pull/3137/files#diff-9d15a2c2ea09662e39dfeb06f50ed190a3c6319ba2d0f3a637527a98fa6f7fb3 |
| var queryTab = urlParams.get('tab'); | ||
|
|
||
| //if url has section id as hash then set it as active or override the current local storage value | ||
| if (window.location.hash) { |
There was a problem hiding this comment.
@josephfusco perhaps we should maintain this mechanism of using the hash?
the deeplinking is technically already working. If I hover the tabs I can see the #name-of-tab in the url and if I copy the link and visit it, the link works 🤔
I do think the improvments to store in localStorage and push to the url are good, but maybe instead of using tab query param, we can continue to use the hash in case anyone already is making use of linking with the hash
There was a problem hiding this comment.
Yes, great call out. I've updated this PR to use the existing hash functionality
|
Code Climate has analyzed commit c597d7d and detected 0 issues on this pull request. View more on Code Climate. |
What does this implement/fix? Explain your changes.
This pull request enhances the tab state management for the WPGraphQL settings page by integrating query arguments with a fallback to localStorage. This ensures that tab states are sharable via URLs while maintaining backward compatibility with users' existing localStorage preferences.
Does this close any currently open issues?
closes #3142
Testing
2024-05-29.at.17.09.37.-.Yellow.Finch.webm