@wordpress/data
Advanced tools
Comparing version 4.26.1 to 4.26.2-next.0
@@ -11,3 +11,4 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray"; | ||
import { useMemo, useRef, useEffect, useLayoutEffect } from '@wordpress/element'; | ||
import { useMemo, useRef } from '@wordpress/element'; | ||
import { useIsomorphicLayoutEffect } from '@wordpress/compose'; | ||
/** | ||
@@ -19,13 +20,2 @@ * Internal dependencies | ||
/** | ||
* Favor useLayoutEffect to ensure the store subscription callback always has | ||
* the dispatchMap from the latest render. If a store update happens between | ||
* render and the effect, this could cause missed/stale updates or | ||
* inconsistent state. | ||
* | ||
* Fallback to useEffect for server rendered components because currently React | ||
* throws a warning when using useLayoutEffect in that environment. | ||
*/ | ||
var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect; | ||
/** | ||
* Custom react hook for returning aggregate dispatch actions using the provided | ||
@@ -32,0 +22,0 @@ * dispatchMap. |
@@ -12,4 +12,5 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
import { createQueue } from '@wordpress/priority-queue'; | ||
import { useLayoutEffect, useRef, useCallback, useEffect, useReducer, useMemo } from '@wordpress/element'; | ||
import { useRef, useCallback, useReducer, useMemo } from '@wordpress/element'; | ||
import isShallowEqual from '@wordpress/is-shallow-equal'; | ||
import { useIsomorphicLayoutEffect } from '@wordpress/compose'; | ||
/** | ||
@@ -21,12 +22,2 @@ * Internal dependencies | ||
import useAsyncMode from '../async-mode-provider/use-async-mode'; | ||
/** | ||
* Favor useLayoutEffect to ensure the store subscription callback always has | ||
* the selector from the latest render. If a store update happens between render | ||
* and the effect, this could cause missed/stale updates or inconsistent state. | ||
* | ||
* Fallback to useEffect for server rendered components because currently React | ||
* throws a warning when using useLayoutEffect in that environment. | ||
*/ | ||
var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect; | ||
var renderQueue = createQueue(); | ||
@@ -33,0 +24,0 @@ /** |
@@ -16,2 +16,4 @@ "use strict"; | ||
var _compose = require("@wordpress/compose"); | ||
var _useRegistry = _interopRequireDefault(require("../registry-provider/use-registry")); | ||
@@ -32,12 +34,2 @@ | ||
/** | ||
* Favor useLayoutEffect to ensure the store subscription callback always has | ||
* the dispatchMap from the latest render. If a store update happens between | ||
* render and the effect, this could cause missed/stale updates or | ||
* inconsistent state. | ||
* | ||
* Fallback to useEffect for server rendered components because currently React | ||
* throws a warning when using useLayoutEffect in that environment. | ||
*/ | ||
var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? _element.useLayoutEffect : _element.useEffect; | ||
/** | ||
* Custom react hook for returning aggregate dispatch actions using the provided | ||
@@ -56,7 +48,6 @@ * dispatchMap. | ||
*/ | ||
var useDispatchWithMap = function useDispatchWithMap(dispatchMap, deps) { | ||
var registry = (0, _useRegistry.default)(); | ||
var currentDispatchMap = (0, _element.useRef)(dispatchMap); | ||
useIsomorphicLayoutEffect(function () { | ||
(0, _compose.useIsomorphicLayoutEffect)(function () { | ||
currentDispatchMap.current = dispatchMap; | ||
@@ -63,0 +54,0 @@ }); |
@@ -20,2 +20,4 @@ "use strict"; | ||
var _compose = require("@wordpress/compose"); | ||
var _useRegistry = _interopRequireDefault(require("../registry-provider/use-registry")); | ||
@@ -36,12 +38,2 @@ | ||
*/ | ||
/** | ||
* Favor useLayoutEffect to ensure the store subscription callback always has | ||
* the selector from the latest render. If a store update happens between render | ||
* and the effect, this could cause missed/stale updates or inconsistent state. | ||
* | ||
* Fallback to useEffect for server rendered components because currently React | ||
* throws a warning when using useLayoutEffect in that environment. | ||
*/ | ||
var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? _element.useLayoutEffect : _element.useEffect; | ||
var renderQueue = (0, _priorityQueue.createQueue)(); | ||
@@ -152,3 +144,3 @@ /** | ||
useIsomorphicLayoutEffect(function () { | ||
(0, _compose.useIsomorphicLayoutEffect)(function () { | ||
latestMapSelect.current = mapSelect; | ||
@@ -167,3 +159,3 @@ latestMapOutput.current = mapOutput; | ||
}); | ||
useIsomorphicLayoutEffect(function () { | ||
(0, _compose.useIsomorphicLayoutEffect)(function () { | ||
var onStoreChange = function onStoreChange() { | ||
@@ -170,0 +162,0 @@ if (isMountedAndNotUnsubscribing.current) { |
### WordPress - Web publishing software | ||
Copyright 2011-2020 by the contributors | ||
Copyright 2011-2021 by the contributors | ||
@@ -37,3 +37,3 @@ This program is free software; you can redistribute it and/or modify | ||
WordPress is released under the GPL | ||
--- | ||
@@ -45,3 +45,3 @@ | ||
Copyright (C) 1989, 1991 Free Software Foundation, Inc. | ||
Copyright (C) 1989, 1991 Free Software Foundation, Inc. | ||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | ||
@@ -140,7 +140,7 @@ | ||
**a)** You must cause the modified files to carry prominent notices | ||
stating that you changed the files and the date of any change. | ||
**b)** You must cause any work that you distribute or publish, that in | ||
@@ -151,3 +151,3 @@ whole or in part contains or is derived from the Program or any part | ||
**c)** If the modified program normally reads commands interactively | ||
@@ -189,3 +189,3 @@ when run, you must cause it, when started running for such interactive | ||
**a)** Accompany it with the complete corresponding machine-readable | ||
@@ -195,3 +195,3 @@ source code, which must be distributed under the terms of Sections 1 | ||
**b)** Accompany it with a written offer, valid for at least three | ||
@@ -204,3 +204,3 @@ years, to give any third party, for a charge no more than your cost of | ||
**c)** Accompany it with the information you received as to the offer | ||
@@ -380,3 +380,3 @@ to distribute corresponding source code. (This alternative is allowed | ||
type `show w'. This is free software, and you are welcome | ||
to redistribute it under certain conditions; type `show c' | ||
to redistribute it under certain conditions; type `show c' | ||
for details. | ||
@@ -396,3 +396,3 @@ | ||
interest in the program `Gnomovision' | ||
(which makes passes at compilers) written | ||
(which makes passes at compilers) written | ||
by James Hacker. | ||
@@ -399,0 +399,0 @@ |
{ | ||
"name": "@wordpress/data", | ||
"version": "4.26.1", | ||
"version": "4.26.2-next.0", | ||
"description": "Data module for WordPress.", | ||
@@ -28,8 +28,8 @@ "author": "The WordPress Contributors", | ||
"@babel/runtime": "^7.12.5", | ||
"@wordpress/compose": "^3.23.1", | ||
"@wordpress/deprecated": "^2.11.0", | ||
"@wordpress/element": "^2.19.0", | ||
"@wordpress/is-shallow-equal": "^3.0.0", | ||
"@wordpress/priority-queue": "^1.10.0", | ||
"@wordpress/redux-routine": "^3.13.0", | ||
"@wordpress/compose": "^3.24.0-next.0", | ||
"@wordpress/deprecated": "^2.11.1-next.0", | ||
"@wordpress/element": "^2.19.1-next.0", | ||
"@wordpress/is-shallow-equal": "^3.0.1-next.0", | ||
"@wordpress/priority-queue": "^1.10.1-next.0", | ||
"@wordpress/redux-routine": "^3.13.1-next.0", | ||
"equivalent-key-map": "^0.2.2", | ||
@@ -46,3 +46,3 @@ "is-promise": "^4.0.0", | ||
}, | ||
"gitHead": "defb705bb3e6285f27d29ea4e32a393b3a9b06ca" | ||
"gitHead": "eb424c9ed3dffb9ca4c31d7c81a3be85b0c94a74" | ||
} |
@@ -9,8 +9,4 @@ /** | ||
*/ | ||
import { | ||
useMemo, | ||
useRef, | ||
useEffect, | ||
useLayoutEffect, | ||
} from '@wordpress/element'; | ||
import { useMemo, useRef } from '@wordpress/element'; | ||
import { useIsomorphicLayoutEffect } from '@wordpress/compose'; | ||
@@ -23,14 +19,2 @@ /** | ||
/** | ||
* Favor useLayoutEffect to ensure the store subscription callback always has | ||
* the dispatchMap from the latest render. If a store update happens between | ||
* render and the effect, this could cause missed/stale updates or | ||
* inconsistent state. | ||
* | ||
* Fallback to useEffect for server rendered components because currently React | ||
* throws a warning when using useLayoutEffect in that environment. | ||
*/ | ||
const useIsomorphicLayoutEffect = | ||
typeof window !== 'undefined' ? useLayoutEffect : useEffect; | ||
/** | ||
* Custom react hook for returning aggregate dispatch actions using the provided | ||
@@ -37,0 +21,0 @@ * dispatchMap. |
@@ -10,11 +10,5 @@ /** | ||
import { createQueue } from '@wordpress/priority-queue'; | ||
import { | ||
useLayoutEffect, | ||
useRef, | ||
useCallback, | ||
useEffect, | ||
useReducer, | ||
useMemo, | ||
} from '@wordpress/element'; | ||
import { useRef, useCallback, useReducer, useMemo } from '@wordpress/element'; | ||
import isShallowEqual from '@wordpress/is-shallow-equal'; | ||
import { useIsomorphicLayoutEffect } from '@wordpress/compose'; | ||
@@ -27,13 +21,2 @@ /** | ||
/** | ||
* Favor useLayoutEffect to ensure the store subscription callback always has | ||
* the selector from the latest render. If a store update happens between render | ||
* and the effect, this could cause missed/stale updates or inconsistent state. | ||
* | ||
* Fallback to useEffect for server rendered components because currently React | ||
* throws a warning when using useLayoutEffect in that environment. | ||
*/ | ||
const useIsomorphicLayoutEffect = | ||
typeof window !== 'undefined' ? useLayoutEffect : useEffect; | ||
const renderQueue = createQueue(); | ||
@@ -40,0 +23,0 @@ |
@@ -86,2 +86,3 @@ /** | ||
const items = registry.select( 'store' ).getItems(); | ||
// eslint-disable-next-line jest/no-conditional-expect | ||
expect( items ).toEqual( [ 1, 2, 3 ] ); | ||
@@ -88,0 +89,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
675302
174
10625
1