-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[docs] Fix parsing of x-date-pickers-pro
demo adapter imports
#11628
Conversation
@@ -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.*)/; |
There was a problem hiding this comment.
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. 🤔
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.*)/; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
Deploy preview: https://deploy-preview-11628--material-ui-x.netlify.app/ |
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.