Skip to content
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

Persist admin menu state to browser storage to ensure quicker render of menu. #45876

Closed
getdave opened this issue Sep 23, 2020 · 1 comment · Fixed by #45957
Closed

Persist admin menu state to browser storage to ensure quicker render of menu. #45876

getdave opened this issue Sep 23, 2020 · 1 comment · Fixed by #45957
Assignees
Labels
[Feature] Calypso & wp-admin Navigation All navigation in Calypso and wp-admin, and the unified transitions between the two. [Type] Task

Comments

@getdave
Copy link
Contributor

getdave commented Sep 23, 2020

We should cache the admin menu data returned from the API endpoint in order to ensure the most suitable menu is rendered near-instantly upon Calypso UI load.

To do this we can use the higher order reducer [withSchemaValidation](https://github.com/Automattic/wp-calypso/blob/ab54e0ce137c96ed697e3d35eb13b8f9698ffc0d/client/state/utils/schema-utils.js#L98 ) providing a suitable schema for the data structure we expect to receive from the API endpoint.

This should cause the data to be cached in browser storage and refreshed as required.

@getdave getdave added [Type] Task [Feature] Calypso & wp-admin Navigation All navigation in Calypso and wp-admin, and the unified transitions between the two. labels Sep 23, 2020
@getdave getdave self-assigned this Sep 23, 2020
@getdave
Copy link
Contributor Author

getdave commented Sep 28, 2020

Note that the entire Redux state is not persisted to the browser. In order to persist state in browser storage the reducer must be wrapped with withSchemaValidation as instructed below.

See https://github.com/Automattic/wp-calypso/blob/master/docs/data-persistence.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Calypso & wp-admin Navigation All navigation in Calypso and wp-admin, and the unified transitions between the two. [Type] Task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant