Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Failed searches are cached: identical searches keep failing until `cacheSearchResultsForSeconds` expires

Closed Beginner friendly
#376 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript
Domain
search

Research direction

Start by locating responsePromiseCache and the client-side search request path, then reproduce the failure using the listed DevTools throttling steps. Done means a rejected search is removed from the cache so the next identical search sends a request, while successful responses and concurrent in-flight sharing remain unchanged.

Written by the indexing model from the issue text.

Description

When the client-side caching is enabled, a search request that fails , stays in the in-flight promise cache. Every identical search after that returns the same error "without sending a request to the server" until the cache TTL expires (2 minutes by default).

Trigger:

  1. A temporary network failure. - The user briefly loses their connectivity, their search fails, connectivity returns, and the same search keeps failing.

Steps to reproduce (tried on a live site)

On a live site (songs-search.typesense.org):

  1. Open DevTools -> Network, filter by multi_search.
  2. Set throttling to Offline and search for a new term, e.g. bad lier. The request fails.
  3. Set throttling back to No throttling, clear the box, and type bad lier again.
  4. No multi_search request is sent and the search fails again. A different term works. bad lier works again after 2 minutes.
Image Image

after cache expires :

Image

Expected behavior

A failed request isn't cached. The next identical search is sent to the server.

Actual behavior

The rejected promise is served from the cache until cacheSearchResultsForSeconds expires.

Proposed fix

Remove the entry from responsePromiseCache when the promise rejects, and re-throw. Successful responses and sharing of concurrent in-flight requests are unchanged.

I'm happy to send a PR for this.

Dominant language
TypeScript
Stars
572
Forks
101
Avg merge
1d 3h
Merged PRs (30d)
4

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from typesense/typesense-js

All issues in typesense/typesense-js

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.