skillrecordings/egghead-next

Resizing window while searching erases current search

lsminter opened this issue · 3 comments

I start on the /q page and I select a topic, then narrow down the browser window really far, it will delete that topic search and puts me back on the /q page. Happens with everything except for instructor pages.

On the instructors it's just a quick flash where we get put back to the original /q page then it quickly reverts back to whatever instructor's page you were on.

Looking at the logs, it seems like the state is getting updated each time I'm re-sizing the window.

https://www.loom.com/share/1c63118c813f45e9a7fb6783ee93a7e2

It looks like it only happens when I'm clicking a topic on the side of the page. If I search for it in the search bar, then I don't run into any issues. Only happens when the topic is selected.

It happens because we re-render RefinementList components depending on viewport resolution (it has different placement on the page in desktop and mobile view). We have to find the way to store chosen topics to solve this issue 🤔

this has been resolved in #1015 by using CSS approach rather than JS one to toggle between desktop and mobile view and thus not clearing refinement state.