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

[Snyk] Upgrade react-redux from 5.0.7 to 8.1.1 #11

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

q1blue
Copy link
Collaborator

@q1blue q1blue commented Aug 10, 2023

This PR was automatically created by Snyk using the credentials of a real user.


Snyk has created this PR to upgrade react-redux from 5.0.7 to 8.1.1.

ℹ️ Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.


Warning: This is a major version upgrade, and may be a breaking change.

  • The recommended version is 59 versions ahead of your current version.
  • The recommended version was released 2 months ago, on 2023-06-21.
Release notes
Package name: react-redux
  • 8.1.1 - 2023-06-21

    This bugfix release tweaks the recent lazy context setup logic to ensure a single React context instance per React version, and removes the recently added RTK peerdep to fix an issue with Yarn workspaces.

    Changelog

    React Context Singletons

    React Context has always relied on reference identity. If you have two different copies of React or a library in a page, that can cause multiple versions of a context instance to be created, leading to problems like the infamous "Could not find react-redux context" error.

    In v8.1.0, we reworked the internals to lazily create our single ReactReduxContext instance to avoid issues in a React Server Components environment.

    This release further tweaks that to stash a single context instance per React version found in the page, thus hopefully avoiding the "multiple copies of the same context" error in the future.

    What's Changed

    Full Changelog: v8.1.0...v8.1.1

  • 8.1.0 - 2023-06-13

    This feature release adds new development-mode safety checks for common errors (like poorly-written selectors), adds a workaround to fix crash errors when React-Redux hooks are imported into React Server Component files, and updates our hooks API docs page with improved explanations and updated links.

    Changelog

    Development Mode Checks for useSelector

    We've had a number of users tell us over time that it's common to accidentally write selectors that have bad behavior and cause performance issues. The most common causes of this are either selectors that unconditionally return a new reference (such as state => state.todos.map() without any memoization ), or selectors that actually return the entire root state ( state => state ).

    We've updated useSelector to add safety checks in development mode that warn if these incorrect behaviors are detected:

    • Selectors will be called twice with the same inputs, and useSelector will warn if the results are different references
    • useSelector will warn if the selector result is actually the entire root state

    By default, these checks only run once the first time useSelector is called. This should provide a good balance between detecting possible issues, and keeping development mode execution performant without adding many unnecessary extra selector calls.

    If you want, you can configure this behavior globally by passing the enum flags directly to <Provider>, or on a per-useSelector basis by passing an options object as the second argument:

    // Example: globally configure the root state "noop" check to run every time
    <Provider store={store} noopCheck="always">
      {children}
    </Provider>
    // Example: configure `useSelector` to specifically run the reference checks differently:
    function Component() {
      // Disable check entirely for this selector
      const count = useSelector(selectCount, { stabilityCheck: 'never' })
      // run once (default)
      const user = useSelector(selectUser, { stabilityCheck: 'once' })
      // ...
    }

    This goes along with the similar safety checks we've added to Reselect v5 alpha as well.

    Context Changes

    We're still trying to work out how to properly use Redux and React Server Components together. One possibility is using RTK Query's createApi to define data fetching endpoints, and using the generated thunks to fetch data in RSCs, but it's still an open question.

    However, users have reported that merely importing any React-Redux API in an RSC file causes a crash, because React.createContext is not defined in RSC files. RTKQ's React-specific createApi entry point imports React-Redux, so it's been unusable in RSCs.

    This release adds a workaround to fix that issue, by using a proxy wrapper around our singleton ReactReduxContext instance and lazily creating that instance on demand. In testing, this appears to both continue to work in all unit tests, and fixes the import error in an RSC environment. We'd appreciate further feedback in case this change does cause any issues for anyone!

    We've also tweaked the internals of the hooks to do checks for correct <Provider> usage when using a custom context, same as the default context checks.

    Docs Updates

    We've cleaned up some of the Hooks API reference page, and updated links to the React docs.

    What's Changed

    • check for Provider even when using custom context by @ EskiMojo14 in #1990
    • Add a stability check, to see if selector returns stable result when called with same parameters. by @ EskiMojo14 in #2000
    • Add an E2E-ish test that verifies behavior when imported into RSCs by @ markerikson in #2030
    • lazily create Context for RSC compat by @ phryneas in #2025
    • Add warning for selectors that return the entire state by @ EskiMojo14 in #2022

    Full Changelog: v8.0.7...v8.1.0

  • 8.0.7 - 2023-05-31

    This release updates the peer dependencies to accept Redux Toolkit, and accept the ongoing RTK and Redux core betas as valid peer deps.

    Note: These changes were initially in 8.0.6, but that had a typo in the peer deps that broke installation. Sorry!

    What's Changed

    Full Changelog: v8.0.5...v8.0.7

  • 8.0.6 - 2023-05-30

    This release updates the peer dependencies to accept Redux Toolkit, and accept the ongoing RTK and Redux core betas as valid peer deps.

    This release has a peer deps typo that breaks installation - please use 8.0.7 instead !

    What's Changed

    • Bump Redux peer deps to accept 5.0 betas, and bump RTK dev dep by @ markerikson in #2017

    Full Changelog: v8.0.5...v8.0.6

  • 8.0.5 - 2022-11-04

    This release fixes a few minor TS issues.

    What's Changed

    Full Changelog: v8.0.4...v8.0.5

  • 8.0.4 - 2022-09-23

    This patch release fixes some minor TS types issues, and updates the rarely-used areStatesEqual option for connect to now pass through ownProps for additional use in determining which pieces of state to compare if desired.

    Note: 8.0.3 was accidentally published without one of these fixes. Use 8.0.4 instead.

    Changelog

    TS Fixes

    We've fixed an import of React that caused issues with the allowSyntheticDefaultImports TS compiler flag in user projects.

    connect already accepted a custom context instance as props.context, and had runtime checks in case users were passing through a real value with app data as props.context instead. However, the TS types did not handle that case, and this would fail to compile. If your own component expects props.context with actual data, connect's types now use that type instead.

    The ConnectedProps<T> type had a mismatch with React's built-in React.ComponentProps<Component> type, and that should now work correctly.

    Other Changes

    The areStatesEqual option to connect now receives ownProps as well, in case you need to make a more specific comparison with certain sections of state.

    The new signature is:

    {
      areStatesEqual?: (
        nextState: State,
        prevState: State,
        nextOwnProps: TOwnProps,
        prevOwnProps: TOwnProps
      ) => boolean
    }

    What's Changed

    • Don't require allowSyntheticDefaultImports: true by @ apepper in #1924
    • Fixed type issue with ComponentProps from older @ types/react by @ Andarist in #1956
    • connect: pass ownProps to areStatesEqual by @ jspurlin in #1951
    • Omit built-in context prop if user component props include context by @ markerikson in #1958

    Full Changelog: v8.0.2...v8.0.4

  • 8.0.3 - 2022-09-23

    This release was accidentally published without an intended fix - please use v8.0.4 instead

  • 8.0.2 - 2022-05-22

    This patch release tweaks the behavior of connect to print a one-time warning when the obsolete pure option is passed in, rather than throwing an error. This fixes crashes caused by libraries such as react-beautiful-dnd continuing to pass in that option (unnecessarily) to React-Redux v8.

    What's Changed

    • Show warning instead of throwing error that pure option has been removed by @ ApacheEx in #1922

    Full Changelog: v8.0.1...v8.0.2

  • 8.0.1 - 2022-04-20
    Read more
  • 8.0.0 - 2022-04-16
  • 8.0.0-rc.1 - 2022-04-13
  • 8.0.0-rc.0 - 2022-04-10
  • 8.0.0-beta.4 - 2022-04-02
  • 8.0.0-beta.3 - 2022-02-06
  • 8.0.0-beta.2 - 2021-12-22
  • 8.0.0-beta.1 - 2021-11-20
  • 8.0.0-beta.0 - 2021-11-19
  • 8.0.0-alpha.1 - 2021-11-02
  • 8.0.0-alpha.0 - 2021-10-03
  • 7.2.9 - 2022-09-23
    Read more
  • 7.2.8 - 2022-04-01
  • 7.2.7 - 2022-03-31
  • 7.2.6 - 2021-10-25
  • 7.2.5 - 2021-09-04
  • 7.2.4 - 2021-04-24
  • 7.2.3 - 2021-03-23
  • 7.2.2 - 2020-10-26
  • 7.2.1 - 2020-07-25
  • 7.2.0 - 2020-02-18
  • 7.1.3 - 2019-11-06
  • 7.1.2 - 2019-11-06
  • 7.1.2-alpha.0 - 2019-11-05
  • 7.1.1 - 2019-08-26
  • 7.1.0 - 2019-06-11
  • 7.1.0-rc.1 - 2019-05-30
  • 7.1.0-alpha.5 - 2019-05-20
  • 7.1.0-alpha.4 - 2019-05-01
  • 7.1.0-alpha.3 - 2019-04-28
  • 7.1.0-alpha.2 - 2019-04-28
  • 7.1.0-alpha.1 - 2019-04-22
  • 7.1.0-alpha.0 - 2019-04-22
  • 7.0.3 - 2019-04-28
  • 7.0.2 - 2019-04-12
  • 7.0.1 - 2019-04-09
  • 7.0.0 - 2019-04-09
  • 7.0.0-beta.1 - 2019-04-04
  • 7.0.0-beta.0 - 2019-03-22
  • 6.0.1 - 2019-02-20
  • 6.0.0 - 2018-12-05
  • 6.0.0-beta.3 - 2018-11-23
  • 6.0.0-beta.2 - 2018-11-06
  • 6.0.0-beta.1 - 2018-11-06
  • 6.0.0-alpha.ede6245 - 2018-09-20
  • 6.0.0-alpha.2a2f108 - 2018-09-20
  • 6.0.0-alpha.9210282 - 2018-09-20
  • 5.1.2 - 2019-10-08
  • 5.1.1 - 2018-11-10
  • 5.1.0 - 2018-10-25
  • 5.1.0-test.1 - 2018-06-21
  • 5.0.7 - 2018-02-16
from react-redux GitHub release notes
Commit messages
Package name: react-redux
  • 44fc725 Remove RTK peerDep
  • 5c76414 Merge pull request #2039 from reduxjs/singletonContext-by-ReactVersion
  • fafce9c create singleton context by React version
  • 28f0aa2 fix: fix typescript error on non exported type (#2034)
  • a222ceb Merge pull request #2037 from reduxjs/docs/switch-umami
  • 3794848 Switch to Railway Umami instance
  • 1e97aac Update action versions
  • 117b397 Release 8.1.0
  • fd26b3b Add release-it config file
  • bf08ea6 Merge pull request #2022 from reduxjs/no-op-check
  • a18e8a9 Update React docs links
  • f9a0de3 Update hooks docs with check details
  • b5f7ec9 add import type rule
  • 94c09f4 Apply suggestions from code review
  • 40b8382 update docs
  • 43c75e2 add test
  • a5e9a43 add no-op check
  • 1812a78 Merge pull request #2025 from reduxjs/pr/lazyContext
  • aaf1364 fixup import
  • 1b350fe Update src/components/Context.ts
  • 51cfc4c lazily create Context for RSC compat
  • a25d15c Merge pull request #2030 from reduxjs/feature/next-rsc-ci-example
  • e1434f7 Build Next RSC example in CI
  • 2730991 Add a `useSelector` call to test behavior with RSCs

Compare


Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.

For more information:

🧐 View latest project report

🛠 Adjust upgrade PR settings

🔕 Ignore this dependency or unsubscribe from future upgrade PRs

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.

2 participants