algolia / algolia/instantsearch
Refinement list gets populated and empty again when entering search page directly from URL
- Dominant language
- TypeScript
- Stars
- 4.1k
- Forks
- 553
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 51
Description
### 🐛 Current behavior
Currently, when entering the search page directly from the URL, the refinement list gets populated, and then, it gets clean again. There's no change on our side, the `query` is still present on the response (so, it didn't get lost), and the only difference in the response from each time, is the `items` value.
[simplescreenrecorder-2024-07-23_12.52.56.webm](https://github.com/user-attachments/assets/a1c9b86a-f079-493a-9de6-aed11e332f03)
In QA/PROD, this is the behavior:
- It's calling 5 times in debugger
- In the first time, `items` is empty
- Only in the last time that `items` get empty
- In connectRefinementList.js:150:
- first time, `items` is empty: status loading
- second time, `items` populated: status is not included
- third time, `items` populated: status loading
- fourth time, `items` populated: status stalled
- fifth time, `items` is empty: status idle
I've also tried to update the packages (4.73.2 and 4.19.0), but it only worked for local env, not other environments. We validated and the package was updated on those environments.
In local, this is the behavior (that's the "expected", since it gets the items populated and not empty):
- It's calling 6 times in debugger
- In the first time, `items` is empty
- Second to last time, `items` are populated
- In connectREfinementList.js:150:
- first time, `items` is empty: status loading
- second time, `items` populated: status is not included
- third time, `items` populated: status loading
- fourth time, `items` populated: status stalled
- fifth time, `items` populated: status loading
- sixth time, `items` populated: status idle
### 🔍 Steps to reproduce
1. Go to https://nuts.com/search/instant?query=cashews
2. Check the box on the left side, responsible for rendering the filters
3. Check that it will populate and then clean the list of facets
### Live reproduction
https://nuts.com/search/instant?query=cashews
### 💭 Expected behavior
The `items` shouldn't be clear after they are populated.
[simplescreenrecorder-2024-07-23_13.04.56.webm](https://github.com/user-attachments/assets/5dd5407e-d796-494f-841c-de10be7b4588)
### Package version
instantsearch.js: ^4.37.3, vue-instantsearch: ^4.17.5
### Operating system
_No response_
### Browser
_No response_
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Contributor guide
Research direction
Start with connectRefinementList.js at line 150 and reproduce the direct-URL flow using the linked live example. Trace the repeated requests and item/status transitions described in the report; done means the refinement items remain populated after the final response instead of being cleared.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- frontend, search
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100