@wordpress/core-data 7.48.2-next.v.202606191442.0 → 7.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/core-data",
3
- "version": "7.48.2-next.v.202606191442.0+17fe7db8a",
3
+ "version": "7.49.0",
4
4
  "description": "Access to and manipulation of core WordPress entities.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -48,22 +48,22 @@
48
48
  "build-module/index.mjs"
49
49
  ],
50
50
  "dependencies": {
51
- "@wordpress/api-fetch": "^7.48.2-next.v.202606191442.0+17fe7db8a",
52
- "@wordpress/block-editor": "^15.22.1-next.v.202606191442.0+17fe7db8a",
53
- "@wordpress/blocks": "^15.21.3-next.v.202606191442.0+17fe7db8a",
54
- "@wordpress/compose": "^8.1.2-next.v.202606191442.0+17fe7db8a",
55
- "@wordpress/data": "^10.48.2-next.v.202606191442.0+17fe7db8a",
56
- "@wordpress/deprecated": "^4.48.2-next.v.202606191442.0+17fe7db8a",
57
- "@wordpress/element": "^8.0.2-next.v.202606191442.0+17fe7db8a",
58
- "@wordpress/html-entities": "^4.48.2-next.v.202606191442.0+17fe7db8a",
59
- "@wordpress/i18n": "^6.21.2-next.v.202606191442.0+17fe7db8a",
60
- "@wordpress/is-shallow-equal": "^5.48.2-next.v.202606191442.0+17fe7db8a",
61
- "@wordpress/private-apis": "^1.48.2-next.v.202606191442.0+17fe7db8a",
62
- "@wordpress/rich-text": "^7.48.2-next.v.202606191442.0+17fe7db8a",
63
- "@wordpress/sync": "^1.48.2-next.v.202606191442.0+17fe7db8a",
64
- "@wordpress/undo-manager": "^1.48.2-next.v.202606191442.0+17fe7db8a",
65
- "@wordpress/url": "^4.48.2-next.v.202606191442.0+17fe7db8a",
66
- "@wordpress/warning": "^3.48.2-next.v.202606191442.0+17fe7db8a",
51
+ "@wordpress/api-fetch": "^7.49.0",
52
+ "@wordpress/block-editor": "^15.22.0",
53
+ "@wordpress/blocks": "^15.22.0",
54
+ "@wordpress/compose": "^8.2.0",
55
+ "@wordpress/data": "^10.49.0",
56
+ "@wordpress/deprecated": "^4.49.0",
57
+ "@wordpress/element": "^8.1.0",
58
+ "@wordpress/html-entities": "^4.49.0",
59
+ "@wordpress/i18n": "^6.22.0",
60
+ "@wordpress/is-shallow-equal": "^5.49.0",
61
+ "@wordpress/private-apis": "^1.49.0",
62
+ "@wordpress/rich-text": "^7.49.0",
63
+ "@wordpress/sync": "^1.49.0",
64
+ "@wordpress/undo-manager": "^1.49.0",
65
+ "@wordpress/url": "^4.49.0",
66
+ "@wordpress/warning": "^3.49.0",
67
67
  "change-case": "^4.1.2",
68
68
  "equivalent-key-map": "^0.2.2",
69
69
  "fast-deep-equal": "^3.1.3",
@@ -91,5 +91,5 @@
91
91
  "publishConfig": {
92
92
  "access": "public"
93
93
  },
94
- "gitHead": "1b6a19222df5a88f161880b5789efb3171d8f425"
94
+ "gitHead": "0e7112a4f4fde4ea15bd9060489b8f6fe11eb6ca"
95
95
  }
@@ -131,7 +131,6 @@ const EMPTY_OBJECT = {};
131
131
  * return (
132
132
  * <form onSubmit={ onRename }>
133
133
  * <TextControl
134
- * __next40pxDefaultSize
135
134
  * label={ __( 'Name' ) }
136
135
  * value={ page.editedRecord.title }
137
136
  * onChange={ setTitle }
@@ -316,6 +316,12 @@ export function isCollaborationSupported( state: State ): boolean {
316
316
  /**
317
317
  * Returns the view configuration for the given entity type.
318
318
  *
319
+ * An optional fourth argument (e.g. `{ fields }`) may be passed when selecting;
320
+ * it is consumed by the `getViewConfig` resolver to request a subset of the
321
+ * config via the REST API `_fields` parameter and does not affect what is read
322
+ * here. Partial responses are merged in the reducer, so the returned object may
323
+ * accumulate properties across requests for the same entity.
324
+ *
319
325
  * @param state Data state.
320
326
  * @param kind Entity kind.
321
327
  * @param name Entity name.
package/src/reducer.js CHANGED
@@ -751,11 +751,18 @@ export function collaborationSupported( state = true, action ) {
751
751
  */
752
752
  export function viewConfigs( state = {}, action ) {
753
753
  switch ( action.type ) {
754
- case 'RECEIVE_VIEW_CONFIG':
754
+ case 'RECEIVE_VIEW_CONFIG': {
755
+ const key = `${ action.kind }/${ action.name }`;
756
+ // Merge so a partial (`_fields`) response doesn't clobber
757
+ // properties already received for the same entity.
755
758
  return {
756
759
  ...state,
757
- [ `${ action.kind }/${ action.name }` ]: action.config,
760
+ [ key ]: {
761
+ ...state[ key ],
762
+ ...action.config,
763
+ },
758
764
  };
765
+ }
759
766
  }
760
767
  return state;
761
768
  }
package/src/resolvers.js CHANGED
@@ -1355,14 +1355,24 @@ export const getEditorAssets =
1355
1355
  /**
1356
1356
  * Requests view config for a given entity type from the REST API.
1357
1357
  *
1358
- * @param {string} kind Entity kind.
1359
- * @param {string} name Entity name.
1358
+ * @param {string} kind Entity kind.
1359
+ * @param {string} name Entity name.
1360
+ * @param {?Object} options Optional options.
1361
+ * @param {?string[]} options.fields Optional subset of top-level config
1362
+ * properties to request, mapped to the REST
1363
+ * API `_fields` parameter. When omitted, the
1364
+ * full config is requested.
1360
1365
  */
1361
1366
  export const getViewConfig =
1362
- ( kind, name ) =>
1367
+ ( kind, name, options = {} ) =>
1363
1368
  async ( { dispatch } ) => {
1369
+ const query = { kind, name };
1370
+ const fields = getNormalizedCommaSeparable( options.fields );
1371
+ if ( fields?.length ) {
1372
+ query._fields = fields.join( ',' );
1373
+ }
1364
1374
  const config = await apiFetch( {
1365
- path: addQueryArgs( '/wp/v2/view-config', { kind, name } ),
1375
+ path: addQueryArgs( '/wp/v2/view-config', query ),
1366
1376
  } );
1367
1377
  dispatch.receiveViewConfig( kind, name, config );
1368
1378
  };