@reduxjs/toolkit
Advanced tools
Comparing version 2.0.0-rc.2 to 2.0.0-rc.3
@@ -10,2 +10,2 @@ import { createSelectorCreator, weakMapMemoize } from 'reselect'; | ||
*/ | ||
export declare const createDraftSafeSelector: import("reselect").CreateSelectorFunction<typeof weakMapMemoize, typeof import("reselect").defaultMemoize>; | ||
export declare const createDraftSafeSelector: import("reselect").CreateSelectorFunction<typeof weakMapMemoize, typeof weakMapMemoize>; |
export * from 'redux'; | ||
export { produce as createNextState, current, freeze, original, isDraft, } from 'immer'; | ||
export type { Draft } from 'immer'; | ||
export { createSelector, createSelectorCreator, defaultMemoize, weakMapMemoize, } from 'reselect'; | ||
export { createSelector, createSelectorCreator, lruMemoize, weakMapMemoize, } from 'reselect'; | ||
export type { Selector, OutputSelector } from 'reselect'; | ||
@@ -6,0 +6,0 @@ export { createDraftSafeSelector, createDraftSafeSelectorCreator, } from './createDraftSafeSelector'; |
@@ -79,3 +79,2 @@ // src/query/react/index.ts | ||
var useIsomorphicLayoutEffect = typeof window !== "undefined" && !!window.document && !!window.document.createElement ? useLayoutEffect : useEffect3; | ||
var defaultMutationStateSelector = (x) => x; | ||
var noPendingQueryStateSelector = (selected) => { | ||
@@ -311,3 +310,7 @@ if (selected.isUninitialized) { | ||
const selectDefaultResult = useMemo2(() => createSelector2([select(stableArg), (_, lastResult) => lastResult, (_) => stableArg], queryStatePreSelector), [select, stableArg]); | ||
const querySelector = useMemo2(() => selectFromResult ? createSelector2([selectDefaultResult], selectFromResult) : selectDefaultResult, [selectDefaultResult, selectFromResult]); | ||
const querySelector = useMemo2(() => selectFromResult ? createSelector2([selectDefaultResult], selectFromResult, { | ||
devModeChecks: { | ||
identityFunctionCheck: "never" | ||
} | ||
}) : selectDefaultResult, [selectDefaultResult, selectFromResult]); | ||
const currentState = useSelector((state) => querySelector(state, lastValue.current), shallowEqual2); | ||
@@ -367,3 +370,3 @@ const store = useStore(); | ||
return ({ | ||
selectFromResult = defaultMutationStateSelector, | ||
selectFromResult, | ||
fixedCacheKey | ||
@@ -392,6 +395,7 @@ } = {}) => { | ||
} = promise || {}; | ||
const mutationSelector = useMemo2(() => createSelector2([select({ | ||
const selectDefaultResult = useMemo2(() => select({ | ||
fixedCacheKey, | ||
requestId: promise?.requestId | ||
})], selectFromResult), [select, promise, selectFromResult, fixedCacheKey]); | ||
}), [fixedCacheKey, promise, select]); | ||
const mutationSelector = useMemo2(() => selectFromResult ? createSelector2([selectDefaultResult], selectFromResult) : selectDefaultResult, [selectFromResult, selectDefaultResult]); | ||
const currentState = useSelector(mutationSelector, shallowEqual2); | ||
@@ -398,0 +402,0 @@ const originalArgs = fixedCacheKey == null ? promise?.arg.originalArgs : void 0; |
{ | ||
"name": "@reduxjs/toolkit", | ||
"version": "2.0.0-rc.2", | ||
"version": "2.0.0-rc.3", | ||
"description": "The official, opinionated, batteries-included toolset for efficient Redux development", | ||
@@ -117,3 +117,3 @@ "author": "Mark Erikson <mark@isquaredsoftware.com>", | ||
"redux-thunk": "^3.0.0-rc.0", | ||
"reselect": "^5.0.0-rc.0" | ||
"reselect": "^5.0.0-rc.1" | ||
}, | ||
@@ -120,0 +120,0 @@ "peerDependencies": { |
@@ -17,3 +17,3 @@ // This must remain here so that the `mangleErrors.cjs` build script | ||
createSelectorCreator, | ||
defaultMemoize, | ||
lruMemoize, | ||
weakMapMemoize, | ||
@@ -20,0 +20,0 @@ } from 'reselect' |
@@ -544,5 +544,2 @@ import type { | ||
const defaultQueryStateSelector: QueryStateSelector<any, any> = (x) => x | ||
const defaultMutationStateSelector: MutationStateSelector<any, any> = (x) => x | ||
/** | ||
@@ -930,3 +927,5 @@ * Wrapper around `defaultQueryStateSelector` to be used in `useQuery`. | ||
selectFromResult | ||
? createSelector([selectDefaultResult], selectFromResult) | ||
? createSelector([selectDefaultResult], selectFromResult, { | ||
devModeChecks: { identityFunctionCheck: 'never' }, | ||
}) | ||
: selectDefaultResult, | ||
@@ -994,6 +993,3 @@ [selectDefaultResult, selectFromResult] | ||
function buildMutationHook(name: string): UseMutation<any> { | ||
return ({ | ||
selectFromResult = defaultMutationStateSelector, | ||
fixedCacheKey, | ||
} = {}) => { | ||
return ({ selectFromResult, fixedCacheKey } = {}) => { | ||
const { select, initiate } = api.endpoints[name] as ApiEndpointMutation< | ||
@@ -1025,9 +1021,12 @@ MutationDefinition<any, any, any, any, any>, | ||
const { requestId } = promise || {} | ||
const selectDefaultResult = useMemo( | ||
() => select({ fixedCacheKey, requestId: promise?.requestId }), | ||
[fixedCacheKey, promise, select] | ||
) | ||
const mutationSelector = useMemo( | ||
() => | ||
createSelector( | ||
[select({ fixedCacheKey, requestId: promise?.requestId })], | ||
selectFromResult | ||
), | ||
[select, promise, selectFromResult, fixedCacheKey] | ||
selectFromResult | ||
? createSelector([selectDefaultResult], selectFromResult) | ||
: selectDefaultResult, | ||
[selectFromResult, selectDefaultResult] | ||
) | ||
@@ -1034,0 +1033,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
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
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
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 too big to display
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5330301
61232
Updatedreselect@^5.0.0-rc.1