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

Modal now generates React warning using a function component as activator #10493

Closed
gavin-hinchley opened this issue Sep 15, 2023 · 1 comment · Fixed by #11266
Closed

Modal now generates React warning using a function component as activator #10493

gavin-hinchley opened this issue Sep 15, 2023 · 1 comment · Fixed by #11266
Labels
Bug Something is broken and not working as intended in the system. Component Priority: Medium Non-blocking regression, noticable inconcistency, or important feature

Comments

@gavin-hinchley
Copy link

gavin-hinchley commented Sep 15, 2023

Issue summary

Attempting to use functional components as an activator for Modal with Polaris11.13.0+results in
Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?

Appears to have been introduced with #10086
Could be related to #10337

Expected behavior

Functional components should continue to work without React errors or warnings.

Actual behavior

Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?
image

Steps to reproduce the problem

  1. Copy the Default ModalExample from the Modal Polaris documentation.
  2. Attempt to use the ModalExample in a unit test or browser.

Specifications

  • Are you using the React components? (Y/N): Y
  • Polaris version number: 11.19.0
  • Browser: Chrome 116.0.5845.140
  • Device: Mac
  • Operating System: MacOS
@gavin-hinchley gavin-hinchley added Bug Something is broken and not working as intended in the system. untriaged labels Sep 15, 2023
@gavin-hinchley gavin-hinchley changed the title Modal now breaks attempting to use function component as activator Modal now generates React warning using a function component as activator Sep 15, 2023
@chloerice chloerice added Priority: Medium Non-blocking regression, noticable inconcistency, or important feature Component and removed untriaged labels Sep 15, 2023
@Roguehp98
Copy link

I believe this error still persists. It can be demonstrated by using the example from docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken and not working as intended in the system. Component Priority: Medium Non-blocking regression, noticable inconcistency, or important feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants