-
Notifications
You must be signed in to change notification settings - Fork 561
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
Fix auto-id
build for backwards compatibility with React <18
#961
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,15 +87,6 @@ function useId( | |
function useId(): string | undefined; | ||
|
||
function useId(providedId?: number | string | undefined | null) { | ||
// TODO: Remove error flag when updating internal deps to React 18. None of | ||
// our tricks will play well with concurrent rendering anyway. | ||
// @ts-expect-error | ||
if (typeof React.useId === "function") { | ||
// @ts-expect-error | ||
let id = React.useId(providedId); | ||
return providedId != null ? providedId : id; | ||
} | ||
Comment on lines
-90
to
-97
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is what is causing the problem. I suggest to simply remove this once only React >=18 is supported. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there no way to rewrite this to keep your build process from showing a warning? I think that would be preferable. |
||
|
||
// If this instance isn't part of the initial render, we don't have to do the | ||
// double render/patch-up dance. We can just generate the ID and return it. | ||
let initialId = providedId ?? (serverHandoffComplete ? genId() : null); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import * as React from "react"; | ||
import WindowSize from "@reach/window-size"; | ||
import { WindowSize } from "@reach/window-size"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The import was wrong |
||
|
||
let name = "Basic"; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Artifact of building Storybook locally.