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

Upgrade our Repo to React 17, tests, VR, examples, etc. #20145

Closed
ling1726 opened this issue Oct 7, 2021 · 6 comments · Fixed by #24356
Closed

Upgrade our Repo to React 17, tests, VR, examples, etc. #20145

ling1726 opened this issue Oct 7, 2021 · 6 comments · Fixed by #24356

Comments

@ling1726
Copy link
Member

ling1726 commented Oct 7, 2021

[some partners are rolling out R17 now, others are planning]

@ling1726 ling1726 created this issue from a note in V-Build - @microsoft/fluentui-react-build (Backlog) Oct 7, 2021
@ling1726
Copy link
Member Author

ling1726 commented Oct 7, 2021

Enzyme does not officially support React 17 enzymejs/enzyme#2430

An unofficial adapter exists, but no guarantee all tests work https://www.npmjs.com/package/@wojtekmaj/enzyme-adapter-react-17

@ling1726 ling1726 added the Status: Blocked Resolution blocked by another issue label Oct 7, 2021
@ecraig12345
Copy link
Member

Related: #15732, #16886

@ecraig12345
Copy link
Member

After #22265, all the tests included in yarn test appear to be working with React 17 and @wojtekmaj/enzyme-adapter-react-17.

@ecraig12345
Copy link
Member

Trying out React 17 again (draft): #22326

Probably everything works except a weird issue with unmounting northstar Popup in tests (not sure if it's a real issue too): #22326 (review)

@ecraig12345
Copy link
Member

As of writing, all the tests work against React 17 (it's possible new breaks could be introduced), but the upgrade attempt (#22326) got blocked when I tried to update the @types/react dev dep to 17.

The latest @types/react 17 version as of writing (17.0.44) includes a reference to Iterable, which is from lib.es2015 and therefore won't compile in v8 packages that only reference lib.es5.

type ReactFragment = {} | Iterable<ReactNode>;

Iterable usage was introduced in 17.0.32, so you could probably work around the issue by setting the repo's @types/react dev dep to 17.0.31. (Anyone looking back at this issue later can also check latest 17 to see if the issue has been resolved.)

Some clarifying notes:

  • Yes this issue is technically limited to v8 packages since they're the only ones that still use lib.es5, but it affects the whole repo unless you want to start introducing different @types/react dev deps per package (not recommended)
  • This should not* affect any package's public API: for consumers, @types/react is already a peer with range >=16.8.0 <18. The version being discussed here is the dev dep within the fluent repo.

* Qualifiers for "should not": The repo's internal @types/react version hopefully shouldn't affect consumers, but I can see a couple ways this could break (so from this perspective, staying on 16 dev dep might be safer).

  • Type alias expansion in generated .d.ts might expose internals of react types in fluent's .d.ts--but I haven't done any testing to see whether this happens in practice. Also this issue was only observed with v9 that I know of, in which case the lib es5 issue doesn't apply. (And pinning to 17.0.31 would eliminate the possibility.)
  • With the complexity of the v9 compose types, it's possible that once the repo upgrades to React 17 types, it would be easier to accidentally change the compose types in a way that's not compatible with React 16 types (like referencing newly-added React type names, or types whose implementation has changed). One way to prevent this would be adding a test similar to typescript minbar but running against different @types/react major versions.

@micahgodbolt
Copy link
Member

Sean mentioned that event delegation in layers in React 17 can cause some issues. Make sure to take a look at that area.

@msft-fluent-ui-bot msft-fluent-ui-bot added Status: Fixed Fixed in some PR and removed Status: In PR labels Aug 22, 2022
@microsoft microsoft locked as resolved and limited conversation to collaborators Sep 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

5 participants