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

[Bug]: Portal Component Not Rendering in Strict Mode #25232

Closed
2 tasks done
Caseyyu2 opened this issue Oct 14, 2022 · 4 comments · Fixed by #25956
Closed
2 tasks done

[Bug]: Portal Component Not Rendering in Strict Mode #25232

Caseyyu2 opened this issue Oct 14, 2022 · 4 comments · Fixed by #25956

Comments

@Caseyyu2
Copy link
Contributor

Caseyyu2 commented Oct 14, 2022

Library

React Components / v9 (@fluentui/react-components)

System Info

I created a sandbox with side by side menu component, one has inline=true, the other set inline=false;
The one with inline=false, the pop over will not shown after click on the menu.

Here's the code sandbox example https://codesandbox.io/s/great-thompson-gkfe8o?file=/src/index.js

Note: I've also tried other portal components, e.g., combobox, dropdown, etc, it's the same behavior the portal component doesn't render correctly

Are you reporting Accessibility issue?

no

Reproduction

https://codesandbox.io/s/great-thompson-gkfe8o?file=/src/index.js

Bug Description

Actual Behavior

only the menu that has inline=false, the flyout/pop over renders correctly.

Expected Behavior

both menu should be able to open successfully

Logs

No response

Requested priority

Normal

Products/sites affected

No response

Are you willing to submit a PR to fix?

no

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.
@ling1726
Copy link
Member

ling1726 commented Oct 14, 2022

The problem is strict mode, removing <StrictMode /> will fix the rendering issue: https://codesandbox.io/s/boring-leavitt-x9huz6?file=/src/index.js

We might still have strict mode bugs

@layershifter layershifter changed the title [Bug]: Portal Component Not Rendering [Bug]: Portal Component Not Rendering in Strict Mode Oct 14, 2022
@paulgildea
Copy link
Member

cc: @GeoffCoxMSFT so we don't lose track.

@miroslavstastny
Copy link
Member

Might be related to #24085. It would be great if we could fix the issues together.

@ling1726
Copy link
Member

One way of doing this would be to use react internals and key the singleton with the id of the current fiber. This would be possible with React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner.current

https://github.com/facebook/react/blob/e7c5af45ceb8fa2b64d39ec68345254ce9abd65e/packages/react/src/ReactCurrentOwner.js#L23
https://github.com/facebook/react/blob/e7c5af45ceb8fa2b64d39ec68345254ce9abd65e/packages/react/src/ReactSharedInternals.js#L21

However, as react states, if we use these internals we cannot expect any official support and they can break at during any release of react

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants