REST API: Make JS Client store schema in session storage.

Props adamsilverstein.
Fixes #38895.

git-svn-id: https://develop.svn.wordpress.org/trunk@39344 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Joe Hoyle 2016-11-23 02:54:24 +00:00
parent e606bc36c1
commit ed13670fde
1 changed files with 1 additions and 1 deletions

View File

@ -1017,7 +1017,7 @@
success: function( newSchemaModel ) { success: function( newSchemaModel ) {
// Store a copy of the schema model in the session cache if available. // Store a copy of the schema model in the session cache if available.
if ( ! _.isUndefined( sessionStorage ) && wpApiSettings.cacheSchema ) { if ( ! _.isUndefined( sessionStorage ) && ( _.isUndefined( wpApiSettings.cacheSchema ) || wpApiSettings.cacheSchema ) ) {
try { try {
sessionStorage.setItem( 'wp-api-schema-model' + model.get( 'apiRoot' ) + model.get( 'versionString' ), JSON.stringify( newSchemaModel ) ); sessionStorage.setItem( 'wp-api-schema-model' + model.get( 'apiRoot' ) + model.get( 'versionString' ), JSON.stringify( newSchemaModel ) );
} catch ( error ) { } catch ( error ) {