Skip to content

search function gets executed twice when loading ?search=foo page #90454

Closed

Description

Steps to reproduce:

  1. Visit https://doc.rust-lang.org/nightly/std/string/trait.ToString.html?search=foo
  2. In Chrome Developer Tools, select Sources > search1.58.0.js
  3. Use the { } in the lower right of that panel to pretty-print
  4. Use search to find function search().
  5. Add a breakpoint by clicking the line number to the left of the function>
  6. Reload the page.
  7. Hit F8 (resume script execution) as many times as necessary for the page to finish loading.

Expected result: Hit F8 only once.

Actual result: Hit F8 twice.

This is relevant because search is a CPU-intensive operation and blocks the UI thread. Doing it twice is a bad user experience.

This is a category of bug we've had at least once before. Rather the fix it by repairing the specific sequence of events that causes it, perhaps we should do some sort of memoization so that if search() is called for an input that is already displayed on the page, we don't actually execute the search again.

/cc @GuillaumeGomez

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Labels

A-rustdoc-uiArea: Rustdoc UI (generated HTML)C-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions