-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Search redirect to Results, won't re render or redirect after initial use #5231
Comments
Well, first off, why not store the results in the Redux store? If someone refreshes the results page, the location state will be lost and they will get no results displayed. This is ultimately a duplicate of #5003. The |
Is there a way to have some sort dialog about this? I've been working on this for the past few days and have tried multiple different ways to get this to work. I tried your suggestion with the Store albeit maybe not in the proper way. Essentially I just want a Results page if you go to it and nothing is there something stating that rendering is totally fine. If the user reloads and there isn't results that's fine too. I looked at #5003 and stating that the Have tried to implement the key suggestion in #5003 by setting the Key State in
However still getting the same results. PR #5162 looks to not be merged so maybe that's why the key doesn't work. I've also tried using the Store in a different way:
|
For those who are still having trouble with this specific use case - having a navbar with an embedded search bar component - the way around the issue of redirecting to a results component is by using componentWillReceiveProps() and (re)setting your state there. https://gist.github.com/ajl100b/51970eb09e59421a6c431f0c9f67b2eb Following the example here, in your cWRP(nextProps), reset the fireRedirect to false. |
Tech
Do want to note this application is not using Redux integration but wanted to mention that it is being used in the project.
Steps to reproduce
Here are the code snippets for the components in question
Search & Results components
Would be happy to provide more if needed
Expected Behavior
Have 2 components, a Search component and a Results component. The Search component is rendered in the Header of the site so it is global. When a user enters text within that Search they will be redirected to the Results component. From the Results view a user can continue on clicking a rendered link or do another Search and re render the Results component
Actual Behavior
You can use the Search component a single time and be redirected to the Results component. If you are on the Results component and try to search again nothing happens. If you Search and redirect to the Results component and you navigate away then try to use Search again nothing happens.
It seems like:
The text was updated successfully, but these errors were encountered: