Closed dmcassel closed 9 years ago
This bug is at the intersection of the search-ctrl and ml-search service, so I'll take a look
Navigation to / usually causes recreation of ctrl. That often implies recreation of searchcontext. One way would be to save search state in request url, but more performant can be to put model in a factory to preserve them between instances of same ctrl..
This issue also occurs in https://github.com/marklogic/slush-marklogic-node..
One issue is that re-entering the main page re-executes the instantiation of the SearchCtrl, and effectively flushes the model that was built in previous visit. That model is easy to preserve by putting it in a factory, and then get that injected as dependency of the Ctrl.
Second issue is that the ml-search tries to put facet selections into the browser url, and the current Ctrl code tries to read those when initializing the Ctrl. But often when you go back to home you don't add those params in the url, but merely link to /. What I did in the last demo is to bypass the fromParams call when model.search.results is defined.
These two changes together make the UI a bit faster as well, as it doesn't rerun search when you go back to home..
@joemfb were you already working on this? From the looks of it I should be able to mimic the changed made in the other project here..
I haven't started yet. I'd love to see what you did. PR?
Okay, I'll do a PR tomorrow morning..
Fixed in develop
On the search page, I click a facet. I click one of the results and go to the detail page. From the detail page, I click the browser's back button. I get back to the search page, but all results are showing instead of just those with the facet value I asked for.