Skip to content

[docs] Fix /api client-side routing#23586

Merged
oliviertassinari merged 6 commits intomui:nextfrom
eps1lon:docs/api-docs-rewrites
Nov 18, 2020
Merged

[docs] Fix /api client-side routing#23586
oliviertassinari merged 6 commits intomui:nextfrom
eps1lon:docs/api-docs-rewrites

Conversation

@eps1lon
Copy link
Member

@eps1lon eps1lon commented Nov 17, 2020

Deploy with all locales (for routing testing): https://5fb41a5e69a49d000885d0cb--material-ui.netlify.app/

Currently navigating to /api pages from within the docs triggers a full page reload.

I assumed that rewrites was working for client-side routing since that was nextjs maintainers explicitly told us. But rewrites don't have any effect on next export. We can achieve the same effect with Link#as it seems.

Used the opportunity to type-check the parts that I worked on.

@eps1lon eps1lon added type: bug It doesn't behave as expected. docs Improvements or additions to the documentation. labels Nov 17, 2020
@mui-pr-bot
Copy link

mui-pr-bot commented Nov 17, 2020

Details of bundle changes

Generated by 🚫 dangerJS against 7345db8

Comment on lines +193 to +195
.map((page) => {
return { ...page, linkProps: { as: page.pathname.replace(/^\/api-docs/, '/api') } };
}),
Copy link
Member Author

Choose a reason for hiding this comment

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

The actual fix.

@eps1lon eps1lon force-pushed the docs/api-docs-rewrites branch from 8499a91 to 7345db8 Compare November 17, 2020 19:17
@eps1lon eps1lon marked this pull request as ready for review November 17, 2020 19:19
@oliviertassinari oliviertassinari merged commit 75dc225 into mui:next Nov 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to the documentation. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants