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 Portal Component to Remove Legacy Context API Usage #7138

Open
kmpeeduwee opened this issue Dec 30, 2024 · 2 comments
Open

Update Portal Component to Remove Legacy Context API Usage #7138

kmpeeduwee opened this issue Dec 30, 2024 · 2 comments

Comments

@kmpeeduwee
Copy link

Description:
The Blueprint5.Portal component currently relies on the legacy contextTypes API, which was removed in React 19. This results in compatibility issues with React 19 and newer. The component should be updated to use the modern React.createContext() API alongside React.useContext() for better compatibility and future-proofing.

Error Message:
Blueprint5.Portal uses the legacy contextTypes API which was removed in React 19. Use React.createContext() with React.useContext() instead. (https://react.dev/link/legacy-context) Component Stack: Portal portal.tsx:82 Overlay2 overlay2.tsx:98 Popper Popper.js:16 Manager Manager.js:5 Popover2 chunk-VCJ3HYCT.js:19285 div unknown:0 ConnectFunction Redux div unknown:0 Router chunk-W3HZJLUQ.mjs:4984 HistoryRouter chunk-W3HZJLUQ.mjs:7117 Provider Redux

Steps to Reproduce:

  1. Use Blueprint5 with React 19.
  2. Render any component that depends on Portal (e.g., Popover2, Overlay2).
  3. Observe the error in the console.

Expected Behavior:
The Portal component should function without errors by leveraging the modern React context API, ensuring compatibility with React 19 and above.

Proposed Solution:

  • Refactor the Portal component to replace the usage of contextTypes with React.createContext() and React.useContext().
  • Ensure compatibility with React 18 and React 19.

Additional Context:

Impact:
This issue affects users upgrading to React 19, potentially breaking applications that depend on the Portal component.

@kmpeeduwee
Copy link
Author

I added a pull reguest - #7137

@bppdddqqqq
Copy link

The pull request does fix the issue, but it won't fully fix up React 19 support. See #7139

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

No branches or pull requests

2 participants