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] Add default preview url #36118

Merged
merged 5 commits into from
Feb 13, 2023
Merged

Conversation

siriwatknp
Copy link
Member

@siriwatknp siriwatknp commented Feb 9, 2023

Before:

Even if there is no docs change, the preview URL should show.

image

After:

image


@siriwatknp siriwatknp added the core Infrastructure work going on behind the scenes label Feb 9, 2023
@mui-bot
Copy link

mui-bot commented Feb 9, 2023

Netlify deploy preview

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

Bundle size report

No bundle size changes

Generated by 🚫 dangerJS against 573860a

@siriwatknp siriwatknp added the regression A bug, but worse label Feb 9, 2023
@siriwatknp siriwatknp requested review from oliviertassinari and a team February 9, 2023 16:12
@siriwatknp siriwatknp marked this pull request as ready for review February 9, 2023 16:15
docs/src/modules/utils/useRouterExtra.ts Outdated Show resolved Hide resolved
const asPathWithoutLang = router.asPath.replace(/^\/[a-zA-Z]{2}\//, '/');
let product = asPathWithoutLang.replace(/^\/([^/]+)\/.*/, '$1');

const asPathWithoutLang = router.asPath.replace(/^\/+[a-zA-Z]{2}\//, '/');
Copy link
Member

Choose a reason for hiding this comment

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

We usually do this in the rest of the codebase.

const { canonicalAs } = pathnameToLanguage(router.asPath);

if (canonicalAs.startsWith('/joy-ui/')) {

Would it make sense to do

Suggested change
const asPathWithoutLang = router.asPath.replace(/^\/+[a-zA-Z]{2}\//, '/');
const { canonicalAs: asPathWithoutLang } = pathnameToLanguage(router.asPath);

And fix

const canonicalAs = userLanguage === 'en' ? pathname : pathname.substring(3);

?

Copy link
Member Author

Choose a reason for hiding this comment

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

For this, I will open another PR to refactor the code and add more tests.

Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
Signed-off-by: Siriwat K <siriwatkunaporn@gmail.com>
@michaldudak michaldudak merged commit 5f9638d into mui:master Feb 13, 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 regression A bug, but worse
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants