From 0def3757461e3065b3551feadaff3b0b5cdd69df Mon Sep 17 00:00:00 2001 From: Mustafa Senoglu Date: Sat, 27 Jun 2026 18:15:51 +0300 Subject: [PATCH 1/2] fix(createReducer): return action from Dispatch to match Redux types The Dispatch type was returning void, which caused TypeScript errors when using createReducer with redux-thunk or other middleware that expect the dispatch to return the action. Fixes #856 --- src/factory/createReducer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/factory/createReducer.ts b/src/factory/createReducer.ts index ef2af42efc..8489d9548a 100644 --- a/src/factory/createReducer.ts +++ b/src/factory/createReducer.ts @@ -1,7 +1,7 @@ import { MutableRefObject, useCallback, useRef, useState } from 'react'; import useUpdateEffect from '../useUpdateEffect'; -type Dispatch = (action: Action) => void; +type Dispatch = (action: Action) => Action; interface Store { getState: () => State; From 0d032faacfdf5c5517e09b1a713c0e48130c61ae Mon Sep 17 00:00:00 2001 From: Mustafa Senoglu Date: Sat, 27 Jun 2026 18:17:11 +0300 Subject: [PATCH 2/2] fix(useDeepCompareEffect): remove warning for primitive dependencies Remove the warning that fires when all dependencies are primitive values. This warning was incorrect because dependencies can change from primitive to non-primitive at runtime, making useDeepCompareEffect the correct choice. The 'no dependencies' warning is preserved as it indicates a likely mistake. Fixes #755 --- src/useDeepCompareEffect.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/useDeepCompareEffect.ts b/src/useDeepCompareEffect.ts index 14c08c4ff0..f08c92228a 100644 --- a/src/useDeepCompareEffect.ts +++ b/src/useDeepCompareEffect.ts @@ -2,8 +2,6 @@ import { DependencyList, EffectCallback } from 'react'; import useCustomCompareEffect from './useCustomCompareEffect'; import isDeepEqual from './misc/isDeepEqual'; -const isPrimitive = (val: any) => val !== Object(val); - const useDeepCompareEffect = (effect: EffectCallback, deps: DependencyList) => { if (process.env.NODE_ENV !== 'production') { if (!(deps instanceof Array) || !deps.length) { @@ -11,12 +9,6 @@ const useDeepCompareEffect = (effect: EffectCallback, deps: DependencyList) => { '`useDeepCompareEffect` should not be used with no dependencies. Use React.useEffect instead.' ); } - - if (deps.every(isPrimitive)) { - console.warn( - '`useDeepCompareEffect` should not be used with dependencies that are all primitive values. Use React.useEffect instead.' - ); - } } useCustomCompareEffect(effect, deps, isDeepEqual);