Ethan Horoschak
01/21/2025, 8:30 PMtypesense-instantsearch-adapter
and react-instantsearch-dom
in a NextJS application. We store the filters, search query, and currently selected hit id in the url query params as well for sharing purposes. We found that if we leave the search page open for a while without interacting — the next time we select a hit, typesense will resend the search request and cause search to load. This doesn’t happen if you are actively using the search and only happens when the tab becomes stale.
I’ve found that commented this line in the attached screenshot which sets the selected hit id in the url query params causes the request to be sent if the tab is stale. Does anyone know why typesense would resend search requests in this situation/how to prevent it?Jason Bosco
01/22/2025, 2:29 AMEthan Horoschak
01/22/2025, 2:31 AMEthan Horoschak
01/22/2025, 2:32 AMJason Bosco
01/22/2025, 2:33 AMJason Bosco
01/22/2025, 2:33 AMEthan Horoschak
01/22/2025, 2:41 AMFanis Tharropoulos
01/22/2025, 9:51 AMcacheSearchResultsForSeconds
to be a smaller value, like 10 seconds or so. By default it's 2 minutes, so if you set it to 10s you can verify that it sends the request when that expiresEthan Horoschak
02/05/2025, 3:39 AMEthan Horoschak
02/05/2025, 3:39 AM