vintasoftware / django-react-boilerplate

Django 5, React, Bootstrap 5 with Python 3 and Webpack project boilerplate
MIT License
1.97k stars 479 forks source link

[Snyk] Upgrade react-redux from 8.0.7 to 8.1.0 #602

Closed hugobessa closed 1 year ago

hugobessa commented 1 year ago

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


Snyk has created this PR to upgrade react-redux from 8.0.7 to 8.1.0.

:information_source: 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.
- The recommended version is **1 version** ahead of your current version. - The recommended version was released **23 days ago**, on 2023-06-13.
Release notes
Package name: react-redux
  • 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

      </li>
      <li>
        <b>8.0.7</b> - <a href="https://snyk.io/redirect/github/reduxjs/react-redux/releases/tag/v8.0.7">2023-05-31</a></br><p>This release updates the peer dependencies to accept Redux Toolkit, and accept the ongoing RTK and Redux core betas as valid peer deps.</p>

    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

      </li>
    </ul>
    from <a href="https://snyk.io/redirect/github/reduxjs/react-redux/releases">react-redux GitHub release notes</a>

Commit messages
Package name: react-redux
  • 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
  • 2eab959 Add React-Redux
  • 45d918b Add initial Next 13.4 example app
  • 6007055 Merge pull request #2000 from reduxjs/selector-check
  • b6cbd2d Update hooks docs with TS types and better descriptions
  • 9a617b3 Copy over wording changes
  • 7039625 rm extra space
  • ca1be67 add equalityFn test
  • e0da9c1 Add docs
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