Update diff viewer to not use $.funcQueue.

Review Request #14102 — Created Aug. 13, 2024 and updated — Latest diff uploaded

Information

Review Board
master

Reviewers

This change introduces a new PromiseQueue, which replaces our old
$.funcQueue system. This works very similarly, where we can add a
bunch of items to the queue and then start it, potentially adding items
even as its running. The big difference is that the individual functions
don't need to care at all that they're running within the queue or ask
the queue to move on to the next item, because they're just promises or
async functions.

This also adds an abort signal, which is both handled internally in the
queue and also passed through to any functions that are included. This
fixes one of our long-standing bugs where rapid switching between
interdiff revisions or commit ranges would cause the displayed diffs to
be incorrect, showing files multiple times or diffs from the wrong
revisions.

  • Ran js-tests.
  • Loaded a ton of different diffs and switched rapidly between revisions
    and commit ranges. Saw that the correct files were always loaded and
    we never got weird duplicates.

Diff Revision 2 (Latest)

orig
1
2

Commits

First Last Summary ID Author
Update diff viewer to not use $.funcQueue.
This change introduces a new `PromiseQueue`, which replaces our old `$.funcQueue` system. This works very similarly, where we can add a bunch of items to the queue and then start it, potentially adding items even as its running. The big difference is that the individual functions don't need to care at all that they're running within the queue or ask the queue to move on to the next item, because they're just promises or async functions. This also adds an abort signal, which is both handled internally in the queue and also passed through to any functions that are included. This fixes one of our long-standing bugs where rapid switching between interdiff revisions or commit ranges would cause the displayed diffs to be incorrect, showing files multiple times or diffs from the wrong revisions. Testing Done: - Ran js-tests. - Loaded a ton of different diffs and switched rapidly between revisions and commit ranges. Saw that the correct files were always loaded and we never got weird duplicates. Bugs Fixed: 3938
aa0377d95f091422df73bf0e45301033651a4472 David Trowbridge
reviewboard/static/rb/js/common/utils/index.ts
reviewboard/static/rb/js/common/utils/promiseQueue.ts
reviewboard/static/rb/js/common/utils/tests/index.ts
reviewboard/static/rb/js/common/utils/tests/promiseQueueTests.ts
reviewboard/static/rb/js/reviews/models/diffViewerPageModel.ts
reviewboard/static/rb/js/reviews/views/diffViewerPageView.ts
Loading...