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

Warn for useFormState on initial render #30292

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

sebmarkbage
Copy link
Collaborator

@sebmarkbage sebmarkbage commented Jul 8, 2024

This was missed in the mount dev dispatcher. It was only in the rerender dispatcher which means that it was only logged during the rerender. Since DevTools can hide logs during rerenders, this hid the warning in StrictMode.

@sebmarkbage sebmarkbage requested a review from acdlite July 8, 2024 18:50
Copy link

vercel bot commented Jul 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 8, 2024 8:37pm

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Jul 8, 2024

import Container from './Container.js';

export function Counter({incrementAction}) {
const [count, incrementFormAction] = useFormState(incrementAction, 0);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been using this to test the warning - that's how I found this bug. Didn't realize that the fixture test was actually supposed to error on this. :P

@sebmarkbage sebmarkbage merged commit 274c980 into facebook:main Jul 8, 2024
139 checks passed
github-actions bot pushed a commit that referenced this pull request Jul 8, 2024
This was missed in the mount dev dispatcher. It was only in the rerender
dispatcher which means that it was only logged during the rerender.
Since DevTools can hide logs during rerenders, this hid the warning in
StrictMode.

DiffTrain build for commit 274c980.
github-actions bot pushed a commit that referenced this pull request Jul 8, 2024
This was missed in the mount dev dispatcher. It was only in the rerender
dispatcher which means that it was only logged during the rerender.
Since DevTools can hide logs during rerenders, this hid the warning in
StrictMode.

DiffTrain build for [274c980](274c980)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants