diff --git a/modules/ppcp-settings/resources/js/data/styling/hooks.js b/modules/ppcp-settings/resources/js/data/styling/hooks.js index 5cf07655e..cb0508247 100644 --- a/modules/ppcp-settings/resources/js/data/styling/hooks.js +++ b/modules/ppcp-settings/resources/js/data/styling/hooks.js @@ -42,6 +42,11 @@ const useHooks = () => { const getLocationProp = useCallback( ( prop ) => { + if ( undefined === persistentData[ location ]?.[ prop ] ) { + console.error( + `Trying to access non-existent style property: ${ location }.${ prop }. Possibly wrong style name - review the reducer.` + ); + } return persistentData[ location ]?.[ prop ]; }, [ location, persistentData ] diff --git a/modules/ppcp-settings/resources/js/data/utils.js b/modules/ppcp-settings/resources/js/data/utils.js index 35d7bbbf9..7d3a14af7 100644 --- a/modules/ppcp-settings/resources/js/data/utils.js +++ b/modules/ppcp-settings/resources/js/data/utils.js @@ -107,7 +107,13 @@ export const createHooksForStore = ( storeName ) => { `Please create the selector "${ selector }" for store "${ storeName }"` ); } - return store[ selector ]()?.[ key ]; + const selectorResult = store[ selector ](); + if ( undefined === selectorResult?.[ key ] ) { + console.error( + `Warning: ${ selector }()[${ key }] is undefined in store "${ storeName }". This may indicate a bug.` + ); + } + return selectorResult?.[ key ]; }, [ key ] );