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

[base-ui][Button] Maintain the disabled prop in SSR #39212

Closed
wants to merge 4 commits into from
Closed

[base-ui][Button] Maintain the disabled prop in SSR #39212

wants to merge 4 commits into from

Conversation

gitstart
Copy link
Contributor

Description

Update button component to maintain button disabled prop across Next.js SSR

closes #38943


This code was written and reviewed by GitStart Community. Growing great engineers, one PR at a time.

…nextjs ssr

Co-authored-by: seunexplicit <48022904+seunexplicit@users.noreply.github.com>
@mui-bot
Copy link

mui-bot commented Sep 29, 2023

Netlify deploy preview

https://deploy-preview-39212--material-ui.netlify.app/

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against eade395

@danilo-leal danilo-leal changed the title MUI-38943 - [base-ui][Button] disabled prop not being passed across Next.js SSR [base-ui][Button] Maintain the disabled prop across Next.js SSR Sep 29, 2023
@simon-abbott
Copy link

simon-abbott commented Sep 29, 2023

I have not tested this, but one problem I ran into when making my local patch fix is hydration mismatching (i.e. the server adding the disabled prop, but the client-side code omitting it during hydration). I strongly suggest that these changes be tested thoroughly against the full matrix of options (button tag, a tag, and custom component, each with focusableWhenDisabled true and false) to make sure no such issues are being introduced.

@mj12albert mj12albert changed the title [base-ui][Button] Maintain the disabled prop across Next.js SSR [base-ui][Button] Maintain the disabled prop in SSR Oct 3, 2023
@mj12albert
Copy link
Member

nit on the title: I think the issue applies to all SSR, not just Next.js 😬

gitstart and others added 2 commits October 6, 2023 13:56
Co-authored-by: seunexplicit <48022904+seunexplicit@users.noreply.github.com>
@gitstart gitstart marked this pull request as ready for review October 6, 2023 14:12
@gitstart gitstart marked this pull request as draft October 6, 2023 14:14
Co-authored-by: seunexplicit <48022904+seunexplicit@users.noreply.github.com>
@gitstart gitstart marked this pull request as ready for review October 6, 2023 15:06
@gitstart
Copy link
Contributor Author

gitstart commented Oct 6, 2023

Thanks for the feedback @simon-abbott, the implementation has been updated

@zannager zannager added component: button This is the name of the generic UI component, not the React module! package: base-ui Specific to @mui/base labels Oct 6, 2023
@mj12albert
Copy link
Member

I thought this would still cause some hydration mismatch errors (Next.js 😪 ) but I tested it a bunch and it seems to work ok!

CC @DiegoAndai for a quick review as well 🙏

@DiegoAndai
Copy link
Member

thought this would still cause some hydration mismatch errors

I have the same thought: how is it not causing errors? 😅 For example, shouldn't this be an immediate hydration mismatch if passing a href prop so the tag would become 'A' client-side? Maybe I'm missing something.

@GitStartHQ GitStartHQ closed this by deleting the head repository Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: button This is the name of the generic UI component, not the React module! package: base-ui Specific to @mui/base
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[base-ui][Button] disabled prop not being passed across Next.js SSR
7 participants