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: use path prefix in navigate/replace/push calls #8289

Merged
merged 8 commits into from
Sep 24, 2018

Conversation

DSchau
Copy link
Contributor

@DSchau DSchau commented Sep 18, 2018

This PR fixes the behavior re: pathPrefix identified in #8155.

Essentially:

  • Uses withPrefix helper in all programmatic navigation
  • Removes manual prefix in onClick handler in Link
  • Adds a number of unit tests and e2e tests

@pieh
Copy link
Contributor

pieh commented Sep 18, 2018

do a elements in static html builds have hrefs with path prefix with those changes?

@DSchau
Copy link
Contributor Author

DSchau commented Sep 18, 2018

@pieh yup, it should! I originally had a variant where they didn't, but they do!

I validated with gatsby-dev-cli. Basically the behavior is unchanged, we'll pass through prefixedTo to reach-router/link, which will just create an a tag with that prefixed link, e.g. these lines

screen shot 2018-09-18 at 3 04 29 pm


describe('navigate', () => {
beforeEach(() => {
cy.visit(`/`)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As info, waitForRouteChange() wasn't working here. Will give it another shot in a bit just to validate I'm not crazy.

Copy link
Contributor

Choose a reason for hiding this comment

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

was it timing out? I've tried some more involved stuff and didn't work for me today too but didn't dig into that yet

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pieh yeah it was!

@pieh pieh merged commit df3ac18 into gatsbyjs:master Sep 24, 2018
@DSchau DSchau deleted the gatsby/navigate-path-prefix branch September 24, 2018 17:39
oorestisime pushed a commit to oorestisime/gatsby that referenced this pull request Sep 28, 2018
…sbyjs#8289)

* fix: prefix navigate calls with pathPrefix

Fixes gatsbyjs#8155

* test: fix unit tests and add a few new ones

* e2e: update integration tests

* test: standardize on trailing slash

* fix: ensure parsePath still works the way it used to with path

* style: run eslint

* fix: use waitForRouteChange API
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants