eui icon indicating copy to clipboard operation
eui copied to clipboard

[EuiFlyout] The test-env variation isn't wrapped in `forwardRef`

Open tkajtoch opened this issue 7 months ago • 2 comments

Describe the bug

When rendering EuiFlyoutResizable in the jest test environment, it results in the following warning being printed out:

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

The cause is the difference in implementation between the regular EuiFlyout (flyout.tsx) and the test-env variant (flyout.testenv.tsx). The latter is not wrapped in forwardRef(), which causes the warning to be printed out.

Impact and severity

End users are not affected by this bug. The warning is only printed out when the test-env build is used.

Environment and versions

  • EUI version: 101.3.0 / latest
  • React version: 18.2.0
  • Kibana version (if applicable): latest
  • Browser: NA
  • Operating System: MacOS

Expected behavior

The test-env build should not warn about the ref prop being passed internally by EuiFlyoutResizable.

Additional context Add any other context about the problem here.

tkajtoch avatar Apr 17 '25 19:04 tkajtoch

@tkajtoch can I do it

pukarlamichhane avatar Apr 18 '25 18:04 pukarlamichhane

@pukarlamichhane go for it!

tkajtoch avatar Apr 18 '25 18:04 tkajtoch

I am happy to work on a PR for this issue!

nicholasaraj avatar Aug 06 '25 00:08 nicholasaraj