@wordpress/core-data 6.3.3 → 6.5.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/CHANGELOG.md +4 -0
- package/README.md +1 -1
- package/build/actions.js +6 -6
- package/build/actions.js.map +1 -1
- package/build/entities.js +7 -7
- package/build/entities.js.map +1 -1
- package/build/hooks/use-entity-record.js +4 -4
- package/build/hooks/use-entity-record.js.map +1 -1
- package/build/hooks/use-entity-records.js +4 -4
- package/build/hooks/use-entity-records.js.map +1 -1
- package/build/hooks/use-resource-permissions.js +2 -2
- package/build/hooks/use-resource-permissions.js.map +1 -1
- package/build/queried-data/selectors.js +4 -1
- package/build/queried-data/selectors.js.map +1 -1
- package/build/reducer.js +3 -1
- package/build/reducer.js.map +1 -1
- package/build/selectors.js +158 -135
- package/build/selectors.js.map +1 -1
- package/build-module/actions.js +6 -6
- package/build-module/actions.js.map +1 -1
- package/build-module/entities.js +7 -6
- package/build-module/entities.js.map +1 -1
- package/build-module/hooks/use-entity-record.js +4 -4
- package/build-module/hooks/use-entity-record.js.map +1 -1
- package/build-module/hooks/use-entity-records.js +4 -4
- package/build-module/hooks/use-entity-records.js.map +1 -1
- package/build-module/hooks/use-resource-permissions.js +2 -2
- package/build-module/hooks/use-resource-permissions.js.map +1 -1
- package/build-module/queried-data/selectors.js +5 -2
- package/build-module/queried-data/selectors.js.map +1 -1
- package/build-module/reducer.js +4 -2
- package/build-module/reducer.js.map +1 -1
- package/build-module/selectors.js +159 -136
- package/build-module/selectors.js.map +1 -1
- package/build-types/actions.d.ts +1 -1
- package/build-types/actions.d.ts.map +1 -1
- package/build-types/entities.d.ts.map +1 -1
- package/build-types/hooks/use-entity-record.d.ts +4 -4
- package/build-types/hooks/use-entity-records.d.ts +4 -4
- package/build-types/hooks/use-resource-permissions.d.ts +2 -2
- package/build-types/index.d.ts +1 -1
- package/build-types/queried-data/selectors.d.ts.map +1 -1
- package/build-types/reducer.d.ts.map +1 -1
- package/build-types/selectors.d.ts +130 -117
- package/build-types/selectors.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/actions.js +6 -6
- package/src/entities.js +1 -2
- package/src/hooks/use-entity-record.ts +4 -4
- package/src/hooks/use-entity-records.ts +4 -4
- package/src/hooks/use-resource-permissions.ts +2 -2
- package/src/queried-data/selectors.js +5 -2
- package/src/reducer.js +2 -6
- package/src/selectors.ts +174 -218
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -58,10 +58,10 @@ export interface Options {
|
|
|
58
58
|
*
|
|
59
59
|
* @since 6.1.0 Introduced in WordPress core.
|
|
60
60
|
*
|
|
61
|
-
* @param
|
|
62
|
-
* @param
|
|
63
|
-
* @param
|
|
64
|
-
* @param
|
|
61
|
+
* @param kind Kind of the entity, e.g. `root` or a `postType`. See rootEntitiesConfig in ../entities.ts for a list of available kinds.
|
|
62
|
+
* @param name Name of the entity, e.g. `plugin` or a `post`. See rootEntitiesConfig in ../entities.ts for a list of available names.
|
|
63
|
+
* @param recordId ID of the requested entity record.
|
|
64
|
+
* @param options Optional hook options.
|
|
65
65
|
* @example
|
|
66
66
|
* ```js
|
|
67
67
|
* import { useEntityRecord } from '@wordpress/core-data';
|
|
@@ -37,10 +37,10 @@ const EMPTY_ARRAY = [];
|
|
|
37
37
|
*
|
|
38
38
|
* @since 6.1.0 Introduced in WordPress core.
|
|
39
39
|
*
|
|
40
|
-
* @param
|
|
41
|
-
* @param
|
|
42
|
-
* @param
|
|
43
|
-
* @param
|
|
40
|
+
* @param kind Kind of the entity, e.g. `root` or a `postType`. See rootEntitiesConfig in ../entities.ts for a list of available kinds.
|
|
41
|
+
* @param name Name of the entity, e.g. `plugin` or a `post`. See rootEntitiesConfig in ../entities.ts for a list of available names.
|
|
42
|
+
* @param queryArgs Optional HTTP query description for how to fetch the data, passed to the requested API endpoint.
|
|
43
|
+
* @param options Optional hook options.
|
|
44
44
|
* @example
|
|
45
45
|
* ```js
|
|
46
46
|
* import { useEntityRecord } from '@wordpress/core-data';
|
|
@@ -46,8 +46,8 @@ type ResourcePermissionsResolution< IdType > = [
|
|
|
46
46
|
*
|
|
47
47
|
* @since 6.1.0 Introduced in WordPress core.
|
|
48
48
|
*
|
|
49
|
-
* @param
|
|
50
|
-
* @param
|
|
49
|
+
* @param resource The resource in question, e.g. media.
|
|
50
|
+
* @param id ID of a specific resource entry, if needed, e.g. 10.
|
|
51
51
|
*
|
|
52
52
|
* @example
|
|
53
53
|
* ```js
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import createSelector from 'rememo';
|
|
5
5
|
import EquivalentKeyMap from 'equivalent-key-map';
|
|
6
|
-
import {
|
|
6
|
+
import { set } from 'lodash';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
@@ -66,7 +66,10 @@ function getQueriedItemsUncached( state, query ) {
|
|
|
66
66
|
|
|
67
67
|
for ( let f = 0; f < fields.length; f++ ) {
|
|
68
68
|
const field = fields[ f ].split( '.' );
|
|
69
|
-
|
|
69
|
+
let value = item;
|
|
70
|
+
field.forEach( ( fieldName ) => {
|
|
71
|
+
value = value[ fieldName ];
|
|
72
|
+
} );
|
|
70
73
|
set( filteredItem, field, value );
|
|
71
74
|
}
|
|
72
75
|
} else {
|
package/src/reducer.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import fastDeepEqual from 'fast-deep-equal/es6';
|
|
5
|
-
import { groupBy
|
|
5
|
+
import { groupBy } from 'lodash';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
@@ -245,11 +245,7 @@ function entity( entityConfig ) {
|
|
|
245
245
|
// comparison.
|
|
246
246
|
! fastDeepEqual(
|
|
247
247
|
edits[ key ],
|
|
248
|
-
|
|
249
|
-
record[ key ],
|
|
250
|
-
'raw',
|
|
251
|
-
record[ key ]
|
|
252
|
-
)
|
|
248
|
+
record[ key ]?.raw ?? record[ key ]
|
|
253
249
|
) &&
|
|
254
250
|
// Sometimes the server alters the sent value which means
|
|
255
251
|
// we need to also remove the edits before the api request.
|