Problem/Motivation

The code in core/scripts/js/assets.js mixes async/await style and Promises. It makes the code hard to follow.

Proposed resolution

Simplify with just using async/await.

CommentFileSizeAuthor
core-assets-simplify.patch7.63 KBnod_

Comments

nod_ created an issue. See original summary.

nod_’s picture

Status: Active » Needs review
wim leers’s picture

Priority: Normal » Major
Issue tags: +blocker

I would love to RTBC this, but don't feel remotely qualified. I don't know enough about how this works.

But, bumping to Major since this blocks #3228464: API for contrib projects to load CKEditor translations (which is Major and essential for the CKEditor 5 module to become stable.)

lauriii’s picture

Status: Needs review » Reviewed & tested by the community

Looks good. Using async/await style everywhere in the file makes sense and makes it much easier to understand.

  • bnjmnm committed 302b310 on 10.0.x
    Issue #3262160 by nod_, lauriii: Simplify code in assets.js, remove mix...

  • bnjmnm committed 068b3ff on 9.4.x
    Issue #3262160 by nod_, lauriii: Simplify code in assets.js, remove mix...
bnjmnm’s picture

Version: 10.0.x-dev » 9.4.x-dev
Status: Reviewed & tested by the community » Fixed

The longest part of reviewing this for commit was the time required to truly understand what assets.js was doing prior to the changes here. The fact that it took as long as it did for me to grok it helps justify the changes here. The changes here make the file significantly easier to understand. With these changes, this file may be maintainable by more than a select elite 🙂.

wim leers’s picture

With these changes, this file may be maintainable by more than a select elite

+1!

nod_’s picture

This needs to be backported to 9.3 if we want to have #3228464: API for contrib projects to load CKEditor translations for 9.3

wim leers’s picture

Status: Fixed » Reviewed & tested by the community

#9++ — I don't see the risk in doing so? But maybe I'm missing something? 🤔

bnjmnm’s picture

Version: 9.4.x-dev » 9.3.x-dev

  • bnjmnm committed 4fa5f16 on 9.3.x
    Issue #3262160 by nod_, lauriii: Simplify code in assets.js, remove mix...
bnjmnm’s picture

Status: Reviewed & tested by the community » Fixed

Wanted feedback on 9.3 and got it. This has been added to that version as well.

wim leers’s picture

Yay! :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.