Repository navigation
fix(docsearch-react): cache requests and avoid redundant Ask AI refreshes - #25
Merged
Merged
Conversation
Collaborator
Author
|
@tharropoulos could you take a look. This directly affects the new docs-site migration. |
tharropoulos
self-requested a review
October 5, 2026 10:29
tharropoulos
reviewed
Oct 5, 2026
tharropoulos
left a comment
Collaborator
There was a problem hiding this comment.
looks good, the ask ai refresh fix is right and caching makes sense. couple of notes
| ...typesenseServerConfig, | ||
| // Autocomplete refreshes on focus. Cache identical requests and in-flight searches by default. | ||
| cacheSearchResultsForSeconds: | ||
| typesenseServerConfig.cacheSearchResultsForSeconds ?? Infinity, |
Collaborator
There was a problem hiding this comment.
fyi the client lives in the modal's useMemo, so the cache resets every time the modal closes (not on page reload like the description says). inline typesenseServerConfig objects will also rebuild it on rerender
1 task done
Collaborator
|
@haydenhoang the new 3.1.1 release of typesense-js includes the fix for the caching, so that line I added a comment on is redundant. Could you bump the deps and check? |
Collaborator
|
lgtm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
This also surfaced an issue in
typesense-jsclient. The SDK should not cache failed request or a 200 multi search response that contain retriable error e.g.500,408time outFor now the docsearch clear all cache when an error occur
typesense.multiSearch.clearCache();, this will be removed once upstream is fixed.