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

fix(gatsby): Support numbers in navigate function #25611

Merged
merged 3 commits into from Jul 10, 2020

Conversation

blainekasten
Copy link
Contributor

Description

Browsers supports navigating with numbers to jump multiple steps forward or backward in the history. Gatsby hasn't supported this yet, but we should to be as aligned with the browsers as we can! This adds that support.

Documentation

Related Issues

Fixes #24739

@blainekasten blainekasten requested a review from a team as a code owner July 8, 2020 14:45
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jul 8, 2020
@blainekasten blainekasten added topic: reach/router and Links type: feature or enhancement Issue that is not a bug and requests the addition of a new feature or enhancement. and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Jul 8, 2020
@gatsby-cloud-staging
Copy link

gatsby-cloud-staging bot commented Jul 8, 2020

Your pull request can be previewed in Gatsby Cloud: https://build-8fa4b2e7-48a7-475c-96ee-0b6dab9a0b8d.staging-previews.gtsb.io

pvdz
pvdz previously approved these changes Jul 8, 2020
Copy link
Contributor

@pvdz pvdz left a comment

Choose a reason for hiding this comment

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

This does sidestep the serviceworker check (line 70) but I presume that's intentional?

I would half expect this kind of change to require more code to change. Nice to see it can be this simple.

Copy link
Contributor

@wardpeet wardpeet left a comment

Choose a reason for hiding this comment

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

I'm testing a few things, I don't think this covers all cases that gatsby needs.

Copy link
Contributor

@wardpeet wardpeet left a comment

Choose a reason for hiding this comment

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

Can you add an e2e test? I get browser errors when testing this with gatsby-link or isn't this meant for gatsby link?

@blainekasten
Copy link
Contributor Author

@wardpeet I don't think it's intended for gatsby-link. More a programmatic API. I haven't tested gatsby-link and it might take more to make that work

@blainekasten
Copy link
Contributor Author

@pvdz I don't think so? This is effectively equivalent to pressing the back or forwards button on the browser.

Copy link
Contributor

@pvdz pvdz left a comment

Choose a reason for hiding this comment

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

looks good to me and was apparently checked with Ward so good to go

@blainekasten blainekasten merged commit 83926c8 into master Jul 10, 2020
@delete-merged-branch delete-merged-branch bot deleted the fix/support-number-navigation branch July 10, 2020 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature or enhancement Issue that is not a bug and requests the addition of a new feature or enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gatsby-link navigate function throws error with numeric parameter
3 participants