Skip to content

Replace react-redux with in-house Provider and hooks - #5964

Merged
Eugene (OEvgeny) merged 4 commits into
mainfrom
OEvgeny/fix-replace-react-redux
Oct 22, 2026
Merged

Eugene (OEvgeny) merged 4 commits into
mainfrom
OEvgeny/fix-replace-react-redux

Conversation

@OEvgeny

@OEvgeny Eugene (OEvgeny) commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Related to #5552.

Changelog Entry

Changed

  • Removed the react-redux dependency, which conflicted with React 19 as a peer dependency, related to #5552, in PR #5964, by @OEvgeny

Description

react-redux@7.2.9 requires React 16.8–18 as a peer dependency, so installing Web Chat with React 19 warns and fails with --strict-peer-deps. Web Chat only used its Provider and three hooks on an internal context, which are now implemented in-house with the same behavior, and react-redux is removed from api and component.

Design

  • Not upgrading react-redux: 8 still caps React at 18, 9 requires React 18 or later.
  • useSelector() re-renders through useReducer() like react-redux@7, not useSyncExternalStore() (react-redux@8/use-sync-external-store): on React 18 it re-renders ahead of <GraphProvider>'s useState() and the development check in useActivities() throws (e.g. selectedAction.html).
  • Store notifications to all hooks run in one unstable_batchedUpdates(), as react-redux@7 does, so React 16/17 and ReactDOM.render() re-render parent and child together.

Specific Changes

  • WebChatReduxContext.ts: useSelector(selector, equalityFn), useDispatch(), useStore() replacing the react-redux hook factories
  • WebChatReduxProvider.tsx: provides the store and a batched subscribe(), used by <Composer>
  • WebChatReduxProvider.spec.tsx: parent and child re-render once together, equalityFn skips re-renders, dispatching in render re-renders once
  • api, component: removed react-redux from package.json
  • I have added tests and executed them locally
  • I have added .changelog/<PR#>-<slug>.md
  • I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

Eugene Olonov added 3 commits October 22, 2026 13:55
react-redux@7.2.9 requires React 16.8-18 as a peer dependency. Web Chat
only used its Provider and useDispatch/useSelector/useStore on an internal
context. useSelector() keeps react-redux@7 behavior: re-renders through
useReducer(), batched store notifications, and the new value is remembered
before re-rendering. useSyncExternalStore() would re-render ahead of
<GraphProvider> on React 18 and trip the development check in
useActivities().
@OEvgeny
Eugene (OEvgeny) marked this pull request as ready for review October 22, 2026 21:58
Copilot AI balanced review requested due to automatic review settings October 22, 2026 21:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@OEvgeny
Eugene (OEvgeny) merged commit d0fdaa7 into main Oct 22, 2026
33 checks passed
@OEvgeny
Eugene (OEvgeny) deleted the OEvgeny/fix-replace-react-redux branch October 22, 2026 22:33
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