Skip to content

Commit

Permalink
rustdoc search: fix cache invalidation error
Browse files Browse the repository at this point in the history
ever since rust-lang#129430, two queries with an identical userQuery can
have different results.  fixed by caching on the original query,
not the case folded version.
  • Loading branch information
lolbinarycat committed Sep 2, 2024
1 parent 3259007 commit 298c25f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/librustdoc/html/static/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -3588,7 +3588,7 @@ async function showResults(results, go_to_first, filterCrates) {
results.query = DocSearch.parseQuery(searchState.input.value);
}

currentResults = results.query.userQuery;
currentResults = results.query.original;

const [ret_others, ret_in_args, ret_returned] = await Promise.all([
addTab(results.others, results.query, true),
Expand Down Expand Up @@ -3719,7 +3719,7 @@ async function search(forced) {
const query = DocSearch.parseQuery(searchState.input.value.trim());
let filterCrates = getFilterCrates();

if (!forced && query.userQuery === currentResults) {
if (!forced && query.original === currentResults) {
if (query.userQuery.length > 0) {
putBackSearch();
}
Expand Down

0 comments on commit 298c25f

Please sign in to comment.