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

DEV_SSR true does not seem to work with no trailing slashes #30750

Closed
iDVB opened this issue Apr 7, 2021 · 1 comment
Closed

DEV_SSR true does not seem to work with no trailing slashes #30750

iDVB opened this issue Apr 7, 2021 · 1 comment
Labels
type: bug An issue or pull request relating to a bug in Gatsby

Comments

@iDVB
Copy link
Contributor

iDVB commented Apr 7, 2021

Description

The new DEV_SSR: true flag does not seem to work properly when testing without trailing slashes.

Using DEV_SSR it seems that gatsby links cannot properly determine isCurrent the same way between the client and server if you do not have a trailing slash. This is causing the mismatch only in the DEV_SSR environment.

During a production build SSR IS able to report on isCurrent and the client and server code indeed match.

We are (have been for a few years) using the gatsby-plugin-remove-trailing-slashes plugin.

Steps to reproduce

  1. Clone this reproduction repo
  2. yarn install
  3. yarn start
  4. browse to http://localhost:8000/test (no trailing slash)
  5. Hard/Full reload the page at least once. (this triggers SSR)
  6. View the following error in the console....
    image

If you wish to further test...

  1. Implement the gatsby-plugin-remove-trailing-slashes
  2. yarn build && yarn serve
  3. Browse to http://localhost:9000/test (no trailing slash)
  4. Compare Server vs Client for that Gatsby Link and notice that they both match.

Expected result

That with DEV_SSR: true it should NOT error/warning about this as it will not be an issue in build.
It seems that DEV_SSR will need to properly be able to detect location in order for this to work.

Actual result

With DEV_SSR: true it is not properly reporting location during SSR only.

Environment

  System:
    OS: macOS 10.15.7
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.15.1 - ~/.nvm/versions/node/v14.15.1/bin/node
    Yarn: 1.22.10 - ~/.nvm/versions/node/v14.15.1/bin/yarn
    npm: 6.14.8 - ~/.nvm/versions/node/v14.15.1/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 89.0.4389.114
    Firefox: 84.0
    Safari: 14.0.3
  npmPackages:
    gatsby: ^3.1.2 => 3.2.1 
    gatsby-plugin-gatsby-cloud: ^2.1.0 => 2.2.0 
    gatsby-plugin-image: ^1.1.2 => 1.2.1 
    gatsby-plugin-manifest: ^3.1.0 => 3.2.0 
    gatsby-plugin-offline: ^4.1.0 => 4.2.0 
    gatsby-plugin-react-helmet: ^4.1.0 => 4.2.0 
    gatsby-plugin-sharp: ^3.1.2 => 3.2.1 
    gatsby-source-filesystem: ^3.1.0 => 3.2.0 
    gatsby-transformer-sharp: ^3.1.0 => 3.2.0 
  npmGlobalPackages:
    gatsby-cli: 3.2.0
@iDVB iDVB added the type: bug An issue or pull request relating to a bug in Gatsby label Apr 7, 2021
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Apr 7, 2021
@LekoArts LekoArts removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Apr 8, 2021
@LekoArts
Copy link
Contributor

LekoArts commented Apr 8, 2021

Hi! Please report your issue in the umbrella discussion as this is the single place for bug reports/feature requests/discussion about that flag/experiment: #28138
Thanks!

@LekoArts LekoArts closed this as completed Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

2 participants