Opened 8 years ago
Closed 8 years ago
#38895 closed defect (bug) (fixed)
REST API JS Client should cache schema in sessionStorage by default when available
Reported by: | adamsilverstein | Owned by: | joehoyle |
---|---|---|---|
Milestone: | 4.7 | Priority: | normal |
Severity: | normal | Version: | 4.7 |
Component: | REST API | Keywords: | has-patch |
Focuses: | javascript | Cc: |
Description
The wp-api
JS client traverses the schema to build out its models and collections. The schema is generally stable and the client is designed to cached the schema in sessionStorage to avoid repeated requests to retrieve the schema. This behavior can be disabled by developers by setting wpApiSettings.cacheSchema
to false; If undefined or true, the schema should be cached.
A bug in the check before storing the schema in sessionStorage means it currently never gets set unless wpApiSettings.cacheSchema
is explicitly set to true.
Patch incoming.
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
@joehoyle I noticed this issue when reviewing the patch on #38342. The schema was getting loaded on each visit to the dashboard. After 38895.diff it only happens once per session.