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

Page props.location.search not updated when query string is changed #6227

Closed
ifvictr opened this issue Jun 29, 2018 · 1 comment
Closed

Page props.location.search not updated when query string is changed #6227

ifvictr opened this issue Jun 29, 2018 · 1 comment

Comments

@ifvictr
Copy link

ifvictr commented Jun 29, 2018

Description

The search value of a page's location prop is not updated when the URL query parameter is changed.

Steps to reproduce

  1. Log props before change.
  2. Change query string.
  3. Log props after change.

Expected result

What should happen?
search should be updated with the value of the new query string.

Actual result

What happened.
search remains the value it was when the component was mounted.

Environment

 System:
    OS: Linux 4.9 Ubuntu 14.04.5 LTS, Trusty Tahr
    CPU: x64 Intel(R) Xeon(R) CPU @ 2.30GHz
    Shell: 4.3.11 - /bin/bash
  Binaries:
    Node: 8.9.4 - ~/.nvm/versions/node/v8.9.4/bin/node
    Yarn: 1.7.0 - ~/.nvm/versions/node/v8.9.4/bin/yarn
    npm: 6.1.0 - ~/.nvm/versions/node/v8.9.4/bin/npm
  npmPackages:
    gatsby: ^1.9.232 => 1.9.273 
    gatsby-link: ^1.6.39 => 1.6.45 
    gatsby-plugin-favicon: ^2.1.1 => 2.1.1 
    gatsby-plugin-react-helmet: ^2.0.7 => 2.0.11 
    gatsby-plugin-react-next: ^1.0.11 => 1.0.11 
    gatsby-plugin-resolve-src: ^1.0.0 => 1.1.3 
    gatsby-plugin-segment: ^1.0.2 => 1.0.2 
    gatsby-plugin-sitemap: ^1.2.25 => 1.2.25 
    gatsby-plugin-styled-components: ^2.0.9 => 2.0.11 
  npmGlobalPackages:
    gatsby-cli: 1.1.58
@ifvictr
Copy link
Author

ifvictr commented Jun 29, 2018

Never mind, found the problem. I was using window.history.pushState instead of navigateTo to change the query parameters. Closing now.

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

No branches or pull requests

1 participant