-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
[docs-infra] Block than more feedback submissions #46824
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
[docs-infra] Block than more feedback submissions #46824
Conversation
Netlify deploy previewhttps://deploy-preview-46824--material-ui.netlify.app/ Bundle size report
|
| const handleSubmitComment = (event) => { | ||
| event.preventDefault(); | ||
| // Block more than one submission. | ||
| if (commentOpen !== true) { |
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.
Why not just
| if (commentOpen !== true) { | |
| if (!commentOpen) { |
?
I believe technically there's a race condition here, if someone clicks fast enough to have the second click come in before the next render 😬. Probably will never happen in practice though.
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.
Why not just
Fair enough. If this file was in TypeScript, I would have done this. Updated.
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.
I believe technically there's a race condition here, if someone clicks fast enough to have the second click come in before the next render 😬. Probably will never happen in practice though.
Agree, we would need to use a ref to be 100% certain but it feels overkill. I'm leaving it as a comment, in case for the future.
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.
yeah, it was more of an observation. I was just wondering what would be a great pattern. Do set state callbacks have to be pure? I suppose otherwise one could do
setOpen(isOpen => {
if (isOpen) sendFeedback()
return false
})but I can't say this excites me in any way. better leave it as is.
Co-authored-by: Jan Potoms <2109932+Janpot@users.noreply.github.com> Signed-off-by: Olivier Tassinari <oliviertassinari@users.noreply.github.com>
Signed-off-by: Olivier Tassinari <oliviertassinari@users.noreply.github.com>
For as long as I can remember, I have seen people leave duplicate feedback. This has been more frequent lately. https://mui-org.slack.com/archives/C0757QYLK7V/p1756026303219189 was the trigger for me to finally spend some time looking at it (I have deleted the duplicate in Slack). I hope it solves the problem, a quick win.
Here is a reproduction:
Screen.Recording.2025-08-24.at.22.54.25.mov