Skip to content

Conversation

@EskiMojo14
Copy link
Collaborator

@EskiMojo14 EskiMojo14 commented Oct 31, 2025

Currently combineSlices does not account for reducers that can receive different state than they return.

The most common example of this would be a reducer that's been through persistReducer, as they can receive an object without the _persist key, but will always return one. combineSlices' current types only care about what's returned, so will always require that _persist key to be passed as part of preloadedState.

declare const baseReducer: Reducer<{ foo: boolean }>

const persistedReducer = persistReducer(baseReducer)

const rootReducer = combineSlices({ bar: persistedReducer });

rootReducer({ bar: { foo: true } }, { type: "" }) // should be allowed, but errors saying _persist is missing

@codesandbox
Copy link

codesandbox bot commented Oct 31, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 31, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit e99debb:

Sandbox Source
@examples-action-listener/counter Configuration
rtk-esm-cra Configuration

@netlify
Copy link

netlify bot commented Oct 31, 2025

Deploy Preview for redux-starter-kit-docs ready!

Name Link
🔨 Latest commit e99debb
🔍 Latest deploy log https://app.netlify.com/projects/redux-starter-kit-docs/deploys/6904e2b94fc31700088db677
😎 Deploy Preview https://deploy-preview-5125--redux-starter-kit-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link

github-actions bot commented Oct 31, 2025

size-limit report 📦

Path Size

@EskiMojo14 EskiMojo14 force-pushed the combineslices-preloadedstate branch from 3c9f9ad to e99debb Compare October 31, 2025 16:24
@markerikson markerikson merged commit e102997 into master Nov 3, 2025
120 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants