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

[core] Use immutable refs #38762

Merged
merged 1 commit into from
Sep 4, 2023

Conversation

oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Sep 2, 2023

Before
Screenshot 2023-09-02 at 23 51 05

After
Screenshot 2023-09-02 at 23 51 16

See for why https://github.com/DefinitelyTyped/DefinitelyTyped/blob/486ea9a7bc7f758d8d8f940e244dd3f447b905ea/types/react/v17/index.d.ts#L1040

The difference is that:
Screenshot 2023-09-02 at 23 52 18

interface RefObject<T> {
  readonly current: T | null;
}

interface MutableRefObject<T> {
  current: T;
}

Does it matter? Probably not, but it seems to be closer to how the API is supposed to be used. It's more accurate.

@oliviertassinari oliviertassinari added typescript core Infrastructure work going on behind the scenes labels Sep 2, 2023
@mui-bot
Copy link

mui-bot commented Sep 2, 2023

Netlify deploy preview

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

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against 00dead4

@michaldudak michaldudak added package: base-ui Specific to @mui/base package: joy-ui Specific to @mui/joy and removed core Infrastructure work going on behind the scenes labels Sep 4, 2023
Copy link
Member

@michaldudak michaldudak left a comment

Choose a reason for hiding this comment

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

👍 Looks good!

@michaldudak michaldudak changed the title [core] None mutable refs [core] Use immutable refs Sep 4, 2023
@michaldudak michaldudak changed the title [core] Use immutable refs [typescript][base-ui][joy-ui] Use immutable refs Sep 4, 2023
@oliviertassinari oliviertassinari changed the title [typescript][base-ui][joy-ui] Use immutable refs [core] Use immutable refs Sep 4, 2023
@oliviertassinari oliviertassinari added the core Infrastructure work going on behind the scenes label Sep 4, 2023
@oliviertassinari oliviertassinari merged commit 45f7e73 into mui:master Sep 4, 2023
27 checks passed
@oliviertassinari oliviertassinari deleted the ref-non-mutable branch September 4, 2023 20:35
@oliviertassinari
Copy link
Member Author

oliviertassinari commented Sep 4, 2023

Haha, I'm guilty of perfectionism as it likely doesn't matter 🙃, but loved the dopamine hit.

mnajdova pushed a commit to mnajdova/material-ui that referenced this pull request Sep 8, 2023
mnajdova pushed a commit to mnajdova/material-ui that referenced this pull request Sep 8, 2023
anon-phantom pushed a commit to anon-phantom/material-ui that referenced this pull request Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes package: base-ui Specific to @mui/base package: joy-ui Specific to @mui/joy typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants