Skip to content

[charts] Rename useIsClient #16937

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 2 commits into from
Mar 13, 2025

Conversation

bernardobelchior
Copy link
Member

Related to #16709 (comment)

@bernardobelchior bernardobelchior added type: enhancement This is not a bug, nor a new feature scope: charts Changes or issues related to the charts product labels Mar 12, 2025
@mui-bot
Copy link

mui-bot commented Mar 12, 2025

Deploy preview: https://deploy-preview-16937--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against 985f86f

Copy link

codspeed-hq bot commented Mar 12, 2025

CodSpeed Performance Report

Merging #16937 will not alter performance

Comparing bernardobelchior:rename-use-is-client (985f86f) with master (06d8025)

Summary

✅ 7 untouched benchmarks

@alexfauquette
Copy link
Member

Since it's my proposal, I let JS review. Maybe he will have better naming

@JCQuintas
Copy link
Member

Since it's my proposal, I let JS review. Maybe he will have better naming

JS review: if (code.looksGood()) return true;

*
* Basically a implementation of Option 2 of this gist: https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85#option-2-lazily-show-component-with-uselayouteffect. */
export function useIsClient() {
const [isClient, setIsClient] = React.useState(false);
export function useIsHydrationDone() {
Copy link
Member

Choose a reason for hiding this comment

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

What about useIsClient/useIsClientSide? is hidration done seems a bit too specific. 😆

Copy link
Member

Choose a reason for hiding this comment

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

The issue is that we could do something like that and it would effectively returns true only on client side

const useIsClient = () => widowns !== undefined

But that's not what we are looking for to avoid hydration missmatch

Copy link
Member

@JCQuintas JCQuintas Mar 12, 2025

Choose a reason for hiding this comment

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

If the issue is specifically for hydration then it makes sense.

Maybe useIsHydrationRender or useIsHydrated 😩💧😁

Copy link
Member Author

Choose a reason for hiding this comment

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

useIsHydrated looks better! Renamed

@bernardobelchior bernardobelchior merged commit 586a1c2 into mui:master Mar 13, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: charts Changes or issues related to the charts product type: enhancement This is not a bug, nor a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants