Convert BaseCollection.fetch to return a promise.

Review Request #11629 — Created May 27, 2021 and submitted — Latest diff uploaded

Information

Review Board
master

Reviewers

This is the first of what is likely to be many steps to move our
codebase towards a more modern feel of using promises and
async/await for asynchronous operations. In this change,
BaseCollection.fetch has been changed, along with everything that
actually uses that including similar methods inside
ResourceCollection. The old callback usage is still available through
a helper which will wrap the returned promise, but causes a warning to
be logged to the console.

This also tweaks to our browserslist config in order to ensure that
async/await won't get polyfilled out due to niche browsers
(primarily on mobile) that we really don't care about supporting.

  • Ran js-tests.
  • Manually tested data population on the review dialog and post commit
    views.

Diff Revision 7 (Latest)

orig
1
2
3
4
5
6
7

Commits

First Last Summary ID Author
Convert BaseCollection.fetch to return a promise.
This is the first of what is likely to be many steps to move our codebase towards a more modern feel of using promises and `async`/`await` for asynchronous operations. In this change, `BaseCollection.fetch` has been changed, along with everything that actually uses that including similar methods inside `ResourceCollection`. The old callback usage is still available through a helper which will wrap the returned promise, but causes a warning to be logged to the console. This also tweaks to our browserslist config in order to ensure that `async`/`await` won't get polyfilled out due to niche browsers (primarily on mobile) that we really don't care about supporting. Testing Done: - Ran js-tests. - Manually tested data population on the review dialog and post commit views.
c6399fe4c61a8bfad98ec8e28a99a93699f16102 David Trowbridge
.browserslistrc
reviewboard/static/rb/js/.jshintrc
reviewboard/static/rb/js/collections/baseCollection.es6.js
reviewboard/static/rb/js/newReviewRequest/views/commitsView.es6.js
reviewboard/static/rb/js/newReviewRequest/views/postCommitView.es6.js
reviewboard/static/rb/js/newReviewRequest/views/tests/postCommitViewTests.es6.js
reviewboard/static/rb/js/resources/collections/repositoryCommitsCollection.es6.js
reviewboard/static/rb/js/resources/collections/resourceCollection.es6.js
reviewboard/static/rb/js/resources/collections/tests/resourceCollectionTests.es6.js
reviewboard/static/rb/js/utils/apiUtils.es6.js
reviewboard/static/rb/js/views/reviewDialogView.es6.js
reviewboard/static/rb/js/views/tests/reviewDialogViewTests.es6.js
Loading...