Developer fixes race condition causing blank search results in npmx registry browser
A bug in npmx, a browser for the npm registry, caused package search results to appear blank on the first search when the saved page size was set to 50 or higher and instant search was disabled. The issue stemmed from a race condition during page initialization, where the saved page-size preference would load mid-search and trigger a secondary fetch before the initial response had completed. This caused an empty interim response to be cached, which took priority over the actual completed results. The fix updates the fetchMore function to wait for any pending search to finish before reading its result, using a dedupe defer strategy to join the in-progress request rather than restarting it. A regression test was also added to confirm that package results are correctly preserved when the page size changes during a pending search.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in