File tree 2 files changed +15
-0
lines changed
2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 4
4
5
5
## 5.5.0 (2024-04-19)
6
6
7
+ ### Enhancements
8
+
9
+ - Improve data-wp-context debugging by validating it as a stringified JSON Object. ([ #61045 ] ( https://github.com/WordPress/gutenberg/pull/61045 ) )
10
+
7
11
### Bug Fixes
8
12
9
13
- Hooks useMemo and useCallback should return a value. ([ #60474 ] ( https://github.com/WordPress/gutenberg/pull/60474 ) )
Original file line number Diff line number Diff line change @@ -241,6 +241,17 @@ export default () => {
241
241
const contextStack = useMemo ( ( ) => {
242
242
if ( defaultEntry ) {
243
243
const { namespace, value } = defaultEntry ;
244
+ // Check that the value is a JSON object. Send a console warning if not.
245
+ if (
246
+ typeof SCRIPT_DEBUG !== 'undefined' &&
247
+ SCRIPT_DEBUG === true &&
248
+ ! isPlainObject ( value )
249
+ ) {
250
+ // eslint-disable-next-line no-console
251
+ console . warn (
252
+ `The value of data-wp-context in "${ namespace } " store must be a valid stringified JSON object.`
253
+ ) ;
254
+ }
244
255
updateSignals ( currentValue . current , {
245
256
[ namespace ] : deepClone ( value ) ,
246
257
} ) ;
You can’t perform that action at this time.
0 commit comments