🥅 Add detection for accessing undefined props

This commit is contained in:
Philipp Stracker 2025-01-16 20:02:37 +01:00
parent 033b6e5b74
commit dac414433f
No known key found for this signature in database
2 changed files with 12 additions and 1 deletions

View file

@ -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 ]