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

[docs] Fix parsing of x-date-pickers-pro demo adapter imports #11628

Merged
merged 1 commit into from
Jan 10, 2024

Conversation

LukasTy
Copy link
Member

@LukasTy LukasTy commented Jan 10, 2024

Noticed that after #11463 and specifically https://github.com/mui/mui-x/pull/11463/files#diff-41c21e2dc42b8c223fc2fa17580e58041afa590fe34d9fbe9a1ffbe5e17d318bL46 our demos using @mui/x-date-pickers-pro/<adapterName> import no longer work, because the regex doesn't account for the possibility of the adapter being imported from the pro package.

@LukasTy LukasTy added bug 🐛 Something doesn't work docs Improvements or additions to the documentation component: pickers This is the name of the generic UI component, not the React module! labels Jan 10, 2024
@LukasTy LukasTy self-assigned this Jan 10, 2024
@LukasTy LukasTy added the needs cherry-pick The PR should be cherry-picked to master after merge label Jan 10, 2024
@@ -18,7 +18,7 @@ export const ADAPTER_TO_LIBRARY: Record<string, string> = {
AdapterMomentJalaali: 'moment-jalaali',
};

const PICKERS_ADAPTER_REGEX = /^@mui\/(lab|x-date-pickers)\/(?<adapterName>Adapter.*)/;
const PICKERS_ADAPTER_REGEX = /^@mui\/(lab|x-date-pickers(?:-pro)?)\/(?<adapterName>Adapter.*)/;
Copy link
Member Author

Choose a reason for hiding this comment

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

We could go with the following if you think that it makes the code more readable. 🤔

Suggested change
const PICKERS_ADAPTER_REGEX = /^@mui\/(lab|x-date-pickers(?:-pro)?)\/(?<adapterName>Adapter.*)/;
const PICKERS_ADAPTER_REGEX = /^@mui\/(lab|x-date-pickers|x-date-pickers-pro)\/(?<adapterName>Adapter.*)/;

Copy link
Member

Choose a reason for hiding this comment

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

I'm honestly fine with both, it's not a regexp we need to tweak regularly

Copy link
Member

Choose a reason for hiding this comment

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

Agree with @flaviendelangle ... both are fine

@mui-bot
Copy link

mui-bot commented Jan 10, 2024

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

Generated by 🚫 dangerJS against 7941da5

@LukasTy LukasTy merged commit cacafd7 into mui:next Jan 10, 2024
21 checks passed
@LukasTy LukasTy deleted the fix-pickers-pro-package-import-parsing branch January 10, 2024 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: pickers This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation needs cherry-pick The PR should be cherry-picked to master after merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants