@wordpress/data 10.47.0 → 10.48.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 +2 -0
- package/package.json +10 -10
- package/src/components/use-select/test/suspense.js +6 -24
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/data",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.48.0",
|
|
4
4
|
"description": "Data module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -45,13 +45,13 @@
|
|
|
45
45
|
"types": "build-types",
|
|
46
46
|
"sideEffects": false,
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@wordpress/compose": "^8.
|
|
49
|
-
"@wordpress/deprecated": "^4.
|
|
50
|
-
"@wordpress/element": "^
|
|
51
|
-
"@wordpress/is-shallow-equal": "^5.
|
|
52
|
-
"@wordpress/priority-queue": "^3.
|
|
53
|
-
"@wordpress/private-apis": "^1.
|
|
54
|
-
"@wordpress/redux-routine": "^5.
|
|
48
|
+
"@wordpress/compose": "^8.1.0",
|
|
49
|
+
"@wordpress/deprecated": "^4.48.0",
|
|
50
|
+
"@wordpress/element": "^8.0.0",
|
|
51
|
+
"@wordpress/is-shallow-equal": "^5.48.0",
|
|
52
|
+
"@wordpress/priority-queue": "^3.48.0",
|
|
53
|
+
"@wordpress/private-apis": "^1.48.0",
|
|
54
|
+
"@wordpress/redux-routine": "^5.48.0",
|
|
55
55
|
"deepmerge": "^4.3.0",
|
|
56
56
|
"equivalent-key-map": "^0.2.2",
|
|
57
57
|
"is-plain-object": "^5.0.0",
|
|
@@ -64,10 +64,10 @@
|
|
|
64
64
|
"deep-freeze": "0.0.1"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
|
-
"react": "^
|
|
67
|
+
"react": "^18.0.0"
|
|
68
68
|
},
|
|
69
69
|
"publishConfig": {
|
|
70
70
|
"access": "public"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "e7856693aeb4e2522d13608cd32c994e4a97cb9c"
|
|
73
73
|
}
|
|
@@ -110,12 +110,10 @@ describe( 'useSuspenseSelect', () => {
|
|
|
110
110
|
render( <App /> );
|
|
111
111
|
await screen.findByLabelText( 'loaded' );
|
|
112
112
|
|
|
113
|
-
// Verify there were
|
|
114
|
-
//
|
|
115
|
-
//
|
|
116
|
-
|
|
117
|
-
// - final fourth render after all data got loaded.
|
|
118
|
-
expect( attempts ).toBe( 4 );
|
|
113
|
+
// Verify there were 3 attempts to render. Suspended twice because of
|
|
114
|
+
// `getToken` and `getData` selectors not being resolved, and then finally
|
|
115
|
+
// rendered after all data got loaded.
|
|
116
|
+
expect( attempts ).toBe( 3 );
|
|
119
117
|
expect( renders ).toBe( 1 );
|
|
120
118
|
} );
|
|
121
119
|
|
|
@@ -231,23 +229,7 @@ describe( 'useSuspenseSelect', () => {
|
|
|
231
229
|
const slowLabel = await screen.findByLabelText( 'slow loaded' );
|
|
232
230
|
expect( slowLabel ).toHaveTextContent( 'slow' );
|
|
233
231
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
// - second (async) render for sibling prerendering that tries to collect all suspending promises.
|
|
237
|
-
// Both `FastUI` and `SlowUI` suspend again but this time the result is not committed, its purpose
|
|
238
|
-
// was just to collect suspending promises.
|
|
239
|
-
// - `FastUI` renders for third time after its suspended promise is resolved. However, this render
|
|
240
|
-
// is _not_ committed because of "suspense fallback throttling". The render is delayed/throttled for 300ms
|
|
241
|
-
// so that the user doesn't see too many and too fast UI flashes. The fallback continues to be rendered.
|
|
242
|
-
// - `SlowUI` suspended promise is resolved and a third render is triggered. However, as the `FastUI` render
|
|
243
|
-
// is not yet committed, a _fourth_ render is triggered, to make sure that we'll be committing the most
|
|
244
|
-
// up-to-date state of the `FastUI` component.
|
|
245
|
-
//
|
|
246
|
-
// The above explains why there are 4 renders of `FastUI` and 3 renders of `SlowUI`. The non-obvious part
|
|
247
|
-
// is explained by a combination of two React features:
|
|
248
|
-
// - sibling prerendering that triggers an extra rerender after one component suspends;
|
|
249
|
-
// - fallback throttling that delays commit by 300ms and triggers an extra rerender.
|
|
250
|
-
expect( FastUI ).toHaveBeenCalledTimes( 4 );
|
|
251
|
-
expect( SlowUI ).toHaveBeenCalledTimes( 3 );
|
|
232
|
+
expect( FastUI ).toHaveBeenCalledTimes( 2 );
|
|
233
|
+
expect( SlowUI ).toHaveBeenCalledTimes( 2 );
|
|
252
234
|
} );
|
|
253
235
|
} );
|