Editor preferences are saved in database every time the Settings sidebar opens/closes
Description
I wonder if this is a bug because a request to /wp/v2/users/me is made every time the Settings sidebar opens/closes. It seems that it is not needed because every update on the preferences modal also triggers a request.
Step-by-step reproduction instructions
-
Go to the Site editor
-
Click on the Settings icon to open or close the sidebar
-
From the Chrome Dev Tools, verify a request to
/wp/v2/users/meis made every time to save the preferences
Screenshots, screen recording, code snippet
Click on the Settings icon to open or close the sidebar and verify a request is made:
https://github.com/WordPress/gutenberg/assets/1881481/e6d5dc5c-8447-46d2-94c7-8edbb9e80e97
Change any preferences from the modal and verify a request is also made:
https://github.com/WordPress/gutenberg/assets/1881481/7f31f98f-bf48-4cb9-a48b-e39e3cab6078
Environment info
- WordPress 6.5.2
- Gutenberg 18.2.0
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
Hello @miksansegundo, I do not think this is an actual issue, but likely a kind of feature for the user. If you can see that, once you close/open the sidebar and then close the site and reopen/reload the site, the sidebar is persisted because it saves your preference to the DB and local storage as well with the option "isComplementaryAreaVisible":true in key WP_PREFERENCES_USER_{user_id}. So not the preferences are the actual preferences, but the open/close for the sidebar is also a preference for the user.
Thank You.