Skip to content

Commit

Permalink
Add shallow support to Link (vercel#2012)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kye Hohenberger authored and arunoda committed May 21, 2017
1 parent 9a30f10 commit 4c52ea1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export default class Link extends Component {

return null
}
]).isRequired
]).isRequired,
shallow: PropTypes.bool
}

componentWillReceiveProps (nextProps) {
Expand All @@ -40,6 +41,7 @@ export default class Link extends Component {
return
}

let { shallow } = this.props
let { href, as } = this

if (!isLocal(href)) {
Expand All @@ -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)
Expand Down

0 comments on commit 4c52ea1

Please sign in to comment.