-
-
Notifications
You must be signed in to change notification settings - Fork 582
fix(react-form): fix cache components support #1913
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d9569cf
fix(react-form): fix cache components support
mhornbacher a5575e1
generate changeset
mhornbacher 2efacf5
Change to patch
mhornbacher cd6dc93
feat: use useId on React 18+ with a fallback to uuid on React 17
mhornbacher 9ec39bb
chore: incredible review feedback
mhornbacher 63b5632
update changelog
mhornbacher a14b433
chore: rename file
mhornbacher 34b41e6
import correctly
mhornbacher cba3df4
return a stable UUID reference
mhornbacher 1601c6a
chore: switch from useMemo to useState
mhornbacher 7546228
ci: apply automated fixes and generate docs
autofix-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { version as reactVersion, useId as useReactId } from 'react' | ||
| import { uuid } from '@tanstack/form-core' | ||
|
|
||
| /** React 17 does not have the useId hook, so we use a random uuid as a fallback. */ | ||
| export function useId() { | ||
| if (reactVersion.split('.')[0] === '17') { | ||
crutchcorn marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return uuid() | ||
| } | ||
|
|
||
| // react-compiler/react-compiler is disabled because useId is not available in React 17. However in React 18+ it is available and we want to use it. | ||
| // eslint-disable-next-line react-compiler/react-compiler, react-hooks/rules-of-hooks | ||
| return useReactId() | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.