Closed btzy closed 3 years ago
Thanks for the bug report @btzy!
This bug occurs in the ElasticSearch-related parts of our module search. This bug is especially prominent in recent times, when our ElasticSearch index is less stable (we are still trying to figure out how to make it more stable).
Offending function: resetSearchFn
in component ModuleFinderApiError
This function gets called when the user presses the "Click to try again" button. Somehow this causes the query params to disappear.
Difficulty: Low
NoHits
component from searchkit
(the library we use to interact with ES) in ModuleFinderContainer
encapsulates the logic for what happens when there is an API failure. It currently controls the ModuleFinderApiError
component, so it's a black-box to us what it is doing, and if it is passing the right resetSearchFn
to ModuleFinderApiError
.
You will have to figure out what searchkit
is doing in NoHits
(this might require you diving into the source code of searchkit, which is OSS), and if we can customise / patch the resetSearchFn
to ideally:
handleSearch
in SearchkitSearchBox
If it is difficult to perform a search retry (or very messy), we can consider a full page reload, which should work if the query params aren't removed. But note that this is not ideal as our webapp is a SPA and we should try to avoid full page reloads.
If you know how to write unit tests, write a unit test to use react-testing-library
's renderWithRouter
to render the error page with some query params, then assert that the query params should still exist after clicking the button.
Change elasticsearchBaseUrl
in website/src/config/app-config.json
to something that doesn't exist, and you should be able to test the 404 page.
cc: @taneliang you have more context about the ES stuff here lmk if there's anything I've incorrectly mentioned
If anyone wants to take it up, do leave a comment here!
Describe the bug
When there is a network/server issue and we can't load modules, the "Click here to try again" button deletes our query, although all filters are retained.
To Reproduce
Steps to reproduce the behavior:
https://nusmods.com/modules?q=geh1042&no-exam=true
)https://nusmods.com/modules?no-exam=true
). This also happens if there were no additional selection parameters after the 'q' parameter.Expected behavior
Don't clear the 'q' parameter.
Screenshots
https://user-images.githubusercontent.com/6948096/122679513-bf484080-d21d-11eb-8966-b6303ad75ea2.mp4
Desktop (please complete the following information):