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] Improve next.js example #22457

Merged
merged 2 commits into from
Sep 3, 2020
Merged

[docs] Improve next.js example #22457

merged 2 commits into from
Sep 3, 2020

Conversation

bhati
Copy link
Contributor

@bhati bhati commented Sep 2, 2020

Forwarding replace prop to NextLink to override the default history push.

Relevant snippet from https://nextjs.org/docs/api-reference/next/link
replace - Replace the current history state instead of adding a new url into the stack. Defaults to false

@mui-pr-bot
Copy link

mui-pr-bot commented Sep 2, 2020

No bundle size changes comparing 995fa45...e4324ff

Generated by 🚫 dangerJS against e4324ff

@mbrookes
Copy link
Member

mbrookes commented Sep 2, 2020

@bhati What's the motivation for the proposed change?

@bhati
Copy link
Contributor Author

bhati commented Sep 2, 2020

@mbrookes
For

<Link replace href="/acme/path" />

Current behavior: /acme/path gets pushed into history stack.

Expected behavior (as per next/link) /acme/path replaces current path in history stack

Reason for unexpected behavior: replace prop is not being passed to NextLink

Hence the changes... hope that clarifies the PR

@oliviertassinari oliviertassinari changed the title Update Link.js [docs] Improve next.js example Sep 2, 2020
@oliviertassinari
Copy link
Member

oliviertassinari commented Sep 2, 2020

Thanks, the TypeScript version ⬇️ needs to match the JavaScript one ⬆️

https://github.com/mui-org/material-ui/blob/995fa45fcdcb00786c6d150e828ace2307c86861/examples/nextjs-with-typescript/src/Link.tsx#L11-L27

@oliviertassinari oliviertassinari added the docs Improvements or additions to the documentation label Sep 2, 2020
@eps1lon eps1lon merged commit eac4dce into mui:next Sep 3, 2020
@eps1lon
Copy link
Member

eps1lon commented Sep 3, 2020

@bhati Thanks!

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants