When state is pushed, the UI does not seem to respond.
See original GitHub issuehttps://github.com/swiftype/demo-asecom/issues/12
This, I think, could be a problem. What if a user does want to push a new state the URL with a new query string. We had this case in an ecommerce demo, where from the main search bar in the header, the autocomplete was configured to navigate to “?q={search_term}”. This was using Gatsby, so that was ultimately a called to pushState
, which we are currently explicitly filtering out.
I think we should instead be detecting that if the push state call is our OWN push state call, then we want to return early. This could possibly done by pushing some additional state that we could inspect.
Issue Analytics
- State:
- Created 4 years ago
- Comments:16 (7 by maintainers)
Top Results From Across the Web
UI does not update on state change · Issue #1 - GitHub
Currently it seems the active param doesn't listen to the provided state, as a result it doesn't seem to update when the state...
Read more >Can't perform a React state update on an unmounted ...
Here is a simple solution for this. This warning is due to when we do some fetch request while that request ...
Read more >React interactivity: Events and state - Learn web development
State is another powerful tool for React because components not only own state, but can update it later. It's not possible to update...
Read more >React Hooks cheat sheet: Best practices with examples
If you find that useState / setState are not updating immediately, the answer is simple: they're just queues. React useState and setState don't ......
Read more >How State Works in React – Explained with Code Examples
So let's fix this. import React from "react"; import ReactDOM from "react-dom"; const rootElement = document. getElementById("root"); let ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@marcvangend I modified your code sandbox, check it out: https://codesandbox.io/s/modest-night-dx1gu
I think this is the way you need to handle a global search box.
key
to your /search route so that it is re-rendered when the search term changesThis is how we’ve dealt with this in the past. If this is insufficient for some reason, let me know.
Thank you for looking into this. Here is a minimalist code sandbox that demonstrates the problem I’m trying solve: https://codesandbox.io/s/busy-haibt-c3vwv. As you can see, the search box triggers a search requests and alters the url, but you don’t get redirected to the search page.