Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ConfiguringYourStore.md #4606

Merged
merged 3 commits into from
Nov 7, 2023
Merged

Conversation

koechkevin
Copy link
Contributor

Prefer to use the callback notation for the middleware option in configureStore to access a pre-typed getDefaultMiddleware instead.


name: 📝 Documentation Fix
about: Fixing a problem in an existing docs page

Checklist

  • Is there an existing issue for this PR?
    • link issue here
  • Have the files been linted and formatted?

What docs page needs to be fixed?

What is the problem?

getDefaultMiddleware import from reduxjs/toolkit has been marked as deprecated. The documentation however still uses import.

What changes does this PR make to fix the problem?

This PR removes the imported getDefaultMiddleware and uses the callback notation for the middleware option.

`getDefaultMiddleware` has been marked as deprecated.

Prefer to use the callback notation for the middleware option in configureStore to access a pre-typed getDefaultMiddleware instead.
@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 20, 2023

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 81f62d0:

Sandbox Source
Vanilla Configuration
Vanilla Typescript Configuration

@netlify
Copy link

netlify bot commented Oct 20, 2023

Deploy Preview for redux-docs ready!

Name Link
🔨 Latest commit 81f62d0
🔍 Latest deploy log https://app.netlify.com/sites/redux-docs/deploys/6549e7a523fbed000946f4de
😎 Deploy Preview https://deploy-preview-4606--redux-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 site configuration.

@markerikson
Copy link
Contributor

Thanks! Could you make one more tweak? Use the specialized gDM().prepend() method. It doesn't do much with JS, but with TS it correctly preserves the types of the middleware. (I know the snippet is JS and not TS, but if we're going to tweak it, might as well show the method we really want folks to use.)

Update to use specialized `getDefaultMiddleware().prepend()` to correctly preserve the types of the middleware in Typescript.
Update documentation to use `getDefaultMiddleware().prepend(loggerMiddleware)`
@EskiMojo14 EskiMojo14 merged commit 3d80cd2 into reduxjs:master Nov 7, 2023
5 checks passed
@EskiMojo14
Copy link
Contributor

thanks!

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