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

[Autocomplete] Move useAutocomplete to the Unstyled package #27485

Merged
merged 3 commits into from
Aug 3, 2021

Conversation

michaldudak
Copy link
Member

@michaldudak michaldudak commented Jul 28, 2021

One chunk of https://github.com/mui-org/material-ui/issues/27170

This change moves the useAutocomplete hook to the Unstyled package. The hook is reexported from the old location, so nothing should break.

I renamed the Value type in useAutocomplete.d.ts to AutocompleteValue, as this type is specific to the Autocomplete component. The type exported from Core has the old Value name to avoid breaking changes.

@michaldudak michaldudak added component: autocomplete This is the name of the generic UI component, not the React module! package: base-ui Specific to @mui/base labels Jul 28, 2021
@mui-pr-bot
Copy link

mui-pr-bot commented Jul 28, 2021

Details of bundle changes (experimental)

@material-ui/lab: parsed: -0.00% 😍, gzip: +0.35%
@material-ui/unstyled: parsed: +30.13% , gzip: +30.51%

Generated by 🚫 dangerJS against 9c8e0ba

@michaldudak michaldudak marked this pull request as ready for review July 28, 2021 09:07
@michaldudak michaldudak requested a review from a team July 28, 2021 09:07
Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

It seems that git is considering the moved filed as "new", not "moved". It sounds like we will lose the ability to blame. Could you double-check this aspect and look into keeping the history?

@michaldudak
Copy link
Member Author

michaldudak commented Jul 28, 2021

@oliviertassinari even though I moved the files from core to unstyled in one commit (which git correctly recognizes as a move) and created new ones in core in another, the whole diff between this branch and next does not show file movements.

@oliviertassinari
Copy link
Member

oliviertassinari commented Jul 28, 2021

the whole diff between this branch and next does not show file movements

The last time I faced this problem I have struggled to figure out who (git, github, github PR view, me) was doing it wrong or right. I recall Sebastian had it right in the past.

@eps1lon
Copy link
Member

eps1lon commented Jul 29, 2021

I recall Sebastian had it right in the past.

Contrary to popular believe git's internals have no notion of "moving" a file. Moving is only computed after the fact (e.g. git-diff, git-blame). You can configure what is considered a "move" in git-diff with find-renames.

git-mv is just a cross-platform convenience helper and basically equivalent to mv + git-add on unix.

So it seems like the default threshold is exceeded because we mix moving and changing in a PR. I would recommend we do one commit where we move and another where we change things i.e. two different PRs.

@michaldudak
Copy link
Member Author

I would recommend we do one commit where we move and another where we change things i.e. two different PRs.

For git these will be just two commits, so it'll essentially be the same as currently on this branch - even though I made one commit with movement and the other one with editing, when diffing between the latter and the base, git does not recognize the movement (and it's not just a matter of GitHub's PR interface - commandline git shows the same result).

@eps1lon
Copy link
Member

eps1lon commented Jul 30, 2021

For git these will be just two commits, so it'll essentially be the same as currently on this branch

That's what I said, yes. This PR is just one commit.

Splitting this PR would work as the commit that just moved the files will actually mark the files as moved in the diff: 99fd646 (#27485)

@michaldudak
Copy link
Member Author

michaldudak commented Jul 30, 2021

I modified this PR to include just moving useAutocomplete to the Unstyled package (+ changes necessary for the green CI). Reexporting from Core is done in #27524.

Once this PR is merged in, I'll rebase #27524 on next and merge it in ASAP.

Copy link
Member

@eps1lon eps1lon 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. GitHub blame should be able to pick up the move.

@oliviertassinari
Copy link
Member

Ohh, thanks for the explanation Sebastian, it makes a lot of sense.

@oliviertassinari oliviertassinari merged commit 35ab090 into mui:next Aug 3, 2021
@oliviertassinari
Copy link
Member

oliviertassinari commented Aug 3, 2021

I'm merging to make the review on part two easier #27524

@michaldudak michaldudak deleted the unstyled-useAutocomplete branch August 23, 2021 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: autocomplete 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.

4 participants