Update dependency react-redux to v8.1.3 #34

Merged
romanjaros merged 1 commit from renovate/react-redux-8.x into master 2023-11-17 21:12:10 +01:00
Member

This PR contains the following updates:

Package Type Update Change
react-redux dependencies minor 8.0.2 -> 8.1.3

Release Notes

reduxjs/react-redux (react-redux)

v8.1.3

Compare Source

This bugfix release fixes an issue with subscriptions being lost when lazy-loaded components are used with React Suspense, and includes stack traces in useSelector usage warnings .

What's Changed

Full Changelog: https://github.com/reduxjs/react-redux/compare/v8.1.2...v8.1.3

v8.1.2

Compare Source

This version changes imports from the React package to namespace imports so the package can safely be imported in React Server Components as long as you don't actually use it - this is for example important if you want to use the React-specifc createApi function from Redux Toolkit.

Some other changes:

  • The behaviour of the "React Context Singletons" from 8.1.1 has been adjusted to also work if you have multiple React instances of the same version (those will now be separated) and if you are in an environment without globalThis (in this case it will fall back to the previous behaviour).
  • We do no longer use Proxies, which should help with some very outdated consumers, e.g. smart TVs, that cannot even polyfill Proxies.

Full Changelog: https://github.com/reduxjs/react-redux/compare/v8.1.1...v8.1.2

v8.1.1

Compare Source

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: https://github.com/reduxjs/react-redux/compare/v8.1.0...v8.1.1

v8.1.0

Compare Source

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

Full Changelog: https://github.com/reduxjs/react-redux/compare/v8.0.7...v8.1.0

v8.0.7

Compare Source

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: https://github.com/reduxjs/react-redux/compare/v8.0.5...v8.0.7

v8.0.6

Compare Source

~~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

Full Changelog: https://github.com/reduxjs/react-redux/compare/v8.0.5...v8.0.6

v8.0.5

Compare Source

This release fixes a few minor TS issues.

What's Changed

Full Changelog: https://github.com/reduxjs/react-redux/compare/v8.0.4...v8.0.5

v8.0.4

Compare Source

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

Full Changelog: https://github.com/reduxjs/react-redux/compare/v8.0.2...v8.0.4

v8.0.3

Compare Source

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


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Renovate Bot.

This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [react-redux](https://github.com/reduxjs/react-redux) | dependencies | minor | [`8.0.2` -> `8.1.3`](https://renovatebot.com/diffs/npm/react-redux/8.0.2/8.1.3) | --- ### Release Notes <details> <summary>reduxjs/react-redux (react-redux)</summary> ### [`v8.1.3`](https://github.com/reduxjs/react-redux/releases/tag/v8.1.3) [Compare Source](https://github.com/reduxjs/react-redux/compare/v8.1.2...v8.1.3) This bugfix release fixes an issue with subscriptions being lost when lazy-loaded components are used with React Suspense, and includes stack traces in `useSelector` usage warnings . #### What's Changed - Add stack to dev mode checks by [@&#8203;EskiMojo14](https://github.com/EskiMojo14) in https://github.com/reduxjs/react-redux/pull/2064 - Fix useSelector() in combination with lazy loaded components breaks with react v18 ([#&#8203;1977](https://github.com/reduxjs/react-redux/issues/1977)) by [@&#8203;jeroenpx](https://github.com/jeroenpx) in https://github.com/reduxjs/react-redux/pull/2068 **Full Changelog**: https://github.com/reduxjs/react-redux/compare/v8.1.2...v8.1.3 ### [`v8.1.2`](https://github.com/reduxjs/react-redux/releases/tag/v8.1.2) [Compare Source](https://github.com/reduxjs/react-redux/compare/v8.1.1...v8.1.2) This version changes imports from the React package to namespace imports so the package can safely be imported in React Server Components as long as you don't actually use it - this is for example important if you want to use the React-specifc `createApi` function from Redux Toolkit. Some other changes: - The behaviour of the "React Context Singletons" from 8.1.1 has been adjusted to also work if you have multiple React instances of the same version (those will now be separated) and if you are in an environment without `globalThis` (in this case it will fall back to the previous behaviour). - We do no longer use Proxies, which should help with some very outdated consumers, e.g. smart TVs, that cannot even polyfill Proxies. **Full Changelog**: https://github.com/reduxjs/react-redux/compare/v8.1.1...v8.1.2 ### [`v8.1.1`](https://github.com/reduxjs/react-redux/releases/tag/v8.1.1) [Compare Source](https://github.com/reduxjs/react-redux/compare/v8.1.0...v8.1.1) 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](https://github.com/reduxjs/react-redux/releases/tag/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 - fix: fix typescript error on non exported type by [@&#8203;luzzif](https://github.com/luzzif) in https://github.com/reduxjs/react-redux/pull/2034 - create singleton context by React version by [@&#8203;phryneas](https://github.com/phryneas) in https://github.com/reduxjs/react-redux/pull/2039 - remove RTK peerDep by [@&#8203;markerikson](https://github.com/markerikson) in [`44fc725`](https://github.com/reduxjs/react-redux/commit/44fc725) **Full Changelog**: https://github.com/reduxjs/react-redux/compare/v8.1.0...v8.1.1 ### [`v8.1.0`](https://github.com/reduxjs/react-redux/releases/tag/v8.1.0) [Compare Source](https://github.com/reduxjs/react-redux/compare/v8.0.7...v8.1.0) 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: ```ts // Example: globally configure the root state "noop" check to run every time <Provider store={store} noopCheck="always"> {children} </Provider> ``` ```ts // 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](https://github.com/reduxjs/reselect/releases/tag/v5.0.0-alpha.2) 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 [@&#8203;EskiMojo14](https://github.com/EskiMojo14) in https://github.com/reduxjs/react-redux/pull/1990 - Add a stability check, to see if selector returns stable result when called with same parameters. by [@&#8203;EskiMojo14](https://github.com/EskiMojo14) in https://github.com/reduxjs/react-redux/pull/2000 - Add an E2E-ish test that verifies behavior when imported into RSCs by [@&#8203;markerikson](https://github.com/markerikson) in https://github.com/reduxjs/react-redux/pull/2030 - lazily create Context for RSC compat by [@&#8203;phryneas](https://github.com/phryneas) in https://github.com/reduxjs/react-redux/pull/2025 - Add warning for selectors that return the entire state by [@&#8203;EskiMojo14](https://github.com/EskiMojo14) in https://github.com/reduxjs/react-redux/pull/2022 **Full Changelog**: https://github.com/reduxjs/react-redux/compare/v8.0.7...v8.1.0 ### [`v8.0.7`](https://github.com/reduxjs/react-redux/releases/tag/v8.0.7) [Compare Source](https://github.com/reduxjs/react-redux/compare/v8.0.6...v8.0.7) 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 - Bump Redux peer deps to accept 5.0 betas, and bump RTK dev dep by [@&#8203;markerikson](https://github.com/markerikson) in https://github.com/reduxjs/react-redux/pull/2017 - [`d45204f`](https://github.com/reduxjs/react-redux/commit/d45204f) : Fix broken RTK peer dep **Full Changelog**: https://github.com/reduxjs/react-redux/compare/v8.0.5...v8.0.7 ### [`v8.0.6`](https://github.com/reduxjs/react-redux/releases/tag/v8.0.6) [Compare Source](https://github.com/reduxjs/react-redux/compare/v8.0.5...v8.0.6) \~~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 [@&#8203;markerikson](https://github.com/markerikson) in https://github.com/reduxjs/react-redux/pull/2017 **Full Changelog**: https://github.com/reduxjs/react-redux/compare/v8.0.5...v8.0.6 ### [`v8.0.5`](https://github.com/reduxjs/react-redux/releases/tag/v8.0.5) [Compare Source](https://github.com/reduxjs/react-redux/compare/v8.0.4...v8.0.5) This release fixes a few minor TS issues. #### What's Changed - `Provider`: pass state (`S`) generic through to `ProviderProps` by [@&#8203;OliverJAsh](https://github.com/OliverJAsh) in https://github.com/reduxjs/react-redux/pull/1960 - wrap `equalityFn` type in `NoInfer` by [@&#8203;phryneas](https://github.com/phryneas) in https://github.com/reduxjs/react-redux/pull/1965 - Fix wrapped component prop types when passing nullish mapDispatchToProps by [@&#8203;marconi1992](https://github.com/marconi1992) in https://github.com/reduxjs/react-redux/pull/1928 **Full Changelog**: https://github.com/reduxjs/react-redux/compare/v8.0.4...v8.0.5 ### [`v8.0.4`](https://github.com/reduxjs/react-redux/releases/tag/v8.0.4) [Compare Source](https://github.com/reduxjs/react-redux/compare/v8.0.3...v8.0.4) 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: ```ts { areStatesEqual?: ( nextState: State, prevState: State, nextOwnProps: TOwnProps, prevOwnProps: TOwnProps ) => boolean } ``` #### What's Changed - Don't require allowSyntheticDefaultImports: true by [@&#8203;apepper](https://github.com/apepper) in https://github.com/reduxjs/react-redux/pull/1924 - Fixed type issue with `ComponentProps` from older `@types/react` by [@&#8203;Andarist](https://github.com/Andarist) in https://github.com/reduxjs/react-redux/pull/1956 - connect: pass ownProps to areStatesEqual by [@&#8203;jspurlin](https://github.com/jspurlin) in https://github.com/reduxjs/react-redux/pull/1951 - Omit built-in context prop if user component props include context by [@&#8203;markerikson](https://github.com/markerikson) in https://github.com/reduxjs/react-redux/pull/1958 **Full Changelog**: https://github.com/reduxjs/react-redux/compare/v8.0.2...v8.0.4 ### [`v8.0.3`](https://github.com/reduxjs/react-redux/releases/tag/v8.0.3) [Compare Source](https://github.com/reduxjs/react-redux/compare/v8.0.2...v8.0.3) **This release was accidentally published without an intended fix - please use [v8.0.4](https://github.com/reduxjs/react-redux/releases/tag/v8.0.4) instead** </details> --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy42MC4yIiwidXBkYXRlZEluVmVyIjoiMzcuNjAuMiIsInRhcmdldEJyYW5jaCI6Im1hc3RlciJ9-->
mr.renovate added 1 commit 2023-11-17 15:02:16 +01:00
Update dependency react-redux to v8.1.3
All checks were successful
forgejo/Procyon/seedling/pipeline/head This commit looks good
forgejo/Procyon/seedling/pipeline/pr-master This commit looks good
5e9b571df3
requested review from romanjaros 2023-11-17 15:02:16 +01:00
romanjaros merged commit 98ee93ed67 into master 2023-11-17 21:12:10 +01:00
romanjaros deleted branch renovate/react-redux-8.x 2023-11-17 21:12:10 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: procyon/seedling#34
No description provided.