Repository navigation
List view: update to remember lastest state rather than needing a preference - #50564
glendaviesnz wants to merge 2 commits into
Conversation
|
Size Change: -38 B (0%) Total Size: 1.39 MB
ℹ️ View Unchanged
|
|
Seems like a good and natural choice. If the user leaves something open then keep it open until the user closes it. |
|
I'm personally into this. But I think the preference was intentionally added as a compromise, maybe @youknowriad recalls? |
youknowriad
left a comment
There was a problem hiding this comment.
For me the issue is not the behavior but the label of the "preference" that says "always open the list view" instead of "open the list view on editor load".
| [ setIsListViewOpened, isListViewOpen ] | ||
| ); | ||
| const toggleListView = useCallback( () => { | ||
| toggleFeature( 'showListViewByDefault' ); |
There was a problem hiding this comment.
Well toggleFeature means, this is still a preference. The only difference is that the preference is not used for the "initial state" but for the "latest state". I think that's not great because it doesn't behave like a preference and because it triggers an API request each time you open/close the list view.
There was a problem hiding this comment.
Sorry about the delay in replying, this one slipped off my list. Yeh, the use of preference here is confusing. If anything it should work the same as the pinned items approach used for the right panels.
Can you see any reason why the list view shouldn't work the same as the right inspector panel, ie. it doesn't have any preference, it just remembers its last state? /cc @jameskoster
There was a problem hiding this comment.
Can you see any reason why the list view shouldn't work the same as the right inspector panel
Not really. The 'remembering' seems more useful / consistent.
Iirc the preference was originally created so that third parties can force List View to be open initially on new sites. As long as there is a way to handle that programmatically, then it would seem reasonable to remove the preference once the remembering is added.
That was my take in #50017 (comment) as well, and I'd say it's worth addressing separately. The behavior in this PR feels like a stand-alone thing, and the aforementioned preference would override it accordingly. IE if you close list view, it would remain closed when you re-enter the editor unless the "Display list view on load" preference is |
What?
Removes the List view toggle preference and instead remembers the last open state of the panel
Why?
Fixes: #50017
How?
Dispatches
toggleFeature( 'showListViewByDefault' )when panel opened or closedTesting Instructions
Screenshots or screencast
Before:
list-view-before.mp4
After:
list-view-after.mp4