1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Add shallow support to Link (#2012)

This commit is contained in:
Kye Hohenberger 2017-05-20 19:54:58 -07:00 committed by Arunoda Susiripala
parent 9a30f10ad8
commit 4c52ea1f70

View file

@ -26,7 +26,8 @@ export default class Link extends Component {
return null
}
]).isRequired
]).isRequired,
shallow: PropTypes.bool
}
componentWillReceiveProps (nextProps) {
@ -40,6 +41,7 @@ export default class Link extends Component {
return
}
let { shallow } = this.props
let { href, as } = this
if (!isLocal(href)) {
@ -64,7 +66,7 @@ export default class Link extends Component {
const changeMethod = replace ? 'replace' : 'push'
// straight up redirect
Router[changeMethod](href, as)
Router[changeMethod](href, as, { shallow })
.then((success) => {
if (!success) return
if (scroll) window.scrollTo(0, 0)