Closed (duplicate)
Project:
Drupal core
Version:
9.5.x-dev
Component:
ajax system
Priority:
Major
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
16 Aug 2021 at 14:11 UTC
Updated:
29 Jun 2022 at 14:21 UTC
Jump to comment: Most recent
Comments
Comment #3
nod_depends on #3228351: Add loadjs library
Comment #4
nod_Comment #5
wim leersThis includes #3228351: Add loadjs library. Marking as blocked on that.
Review posted!
Comment #6
nod_Comment #7
nod_Probably needs some tests to make sure the new add_js command works as expected.
Comment #10
wim leersCrediting @olli and @droplet, marking NW for the unaddressed pieces of feedback.
Comment #11
wim leersWould still be great to land this before 9.3.0 🤓
Comment #13
wim leersLooks like we missed the 9.3 boat. 9.4? 🤞
Comment #14
andypostComment #16
bartlangelaanI added addressed all comments, please check MR !1065.
Comment #17
joseph.olstadI got a patch from this merge request however it does not work when using the clientside_validation module.
Perhaps someone that understands this functionality could integrate this solution into the clientside_validation module.
Until then I suggest instead a solution over here:
#1988968-268: Drupal.ajax does not guarantee that "add new JS file to page" commands have finished before calling said JS
Comment #18
nod_Yes this issue only add the ajax command and doesn't do anything with it.
Making use of it and being able to test is left to #1988968: Drupal.ajax does not guarantee that "add new JS file to page" commands have finished before calling said JS.
RTBC because it looks good to me and can't introduce regressions since it's not used anywhere yet :)
Comment #19
wim leers#18++
Comment #20
lauriiiWhy are we adding this logic here and adding tests for it in #1988968: Drupal.ajax does not guarantee that "add new JS file to page" commands have finished before calling said JS? It seems strange to add API like this without any test coverage when it's initially introduced. At minimum, we need to update the issue summary with reasoning for the proposed approach.
Comment #21
nod_Promise based code can be confusing and hard to get right.
Here we have only the add js part, and there is no impact on existing sites because we Don't change the logic of command execution, that new execution pipeline also involves promises so splitting this makes it easier to understand/review
At least that's the theory.
Comment #22
wim leersBack to RTBC per #21.
Comment #23
lauriiiIf there are no tests, what are the expected steps for validating that what is being done here is right? There's also no issue summary which makes it even harder.
I'm not yet convinced that the two step process here makes it easier to understand or review 🤷♂️
Comment #24
nod_The main issue was split in 3 so that we could get a quick commits for each of them individually. That didn't happen though.
We added loadjs #3228351: Add loadjs library but we have no tests or code using it, next we add this piece of code without building a whole thing just for testing this part, and the last commit changes the ajax command execution pipeline and integrates everything together with all the required tests and changes in the various modules needing it.
We could test it but it would take a lot of efforts when the tests can be done much more easily in #1988968: Drupal.ajax does not guarantee that "add new JS file to page" commands have finished before calling said JS (and we would have to undo everything we added here).
Comment #25
nod_We had a few discussions on the piece of code I'm personally happy it wasn't in a huge patch.
we're used to monster patches but it doesn't have to be this way :) things can be split up.
Comment #26
catchI think it's OK to add the new API here and add the test coverage for it in #1988968: Drupal.ajax does not guarantee that "add new JS file to page" commands have finished before calling said JS, the other option would be merging the issues back together again, but that makes #1988968: Drupal.ajax does not guarantee that "add new JS file to page" commands have finished before calling said JS bigger and more complex to review.
Comment #27
wim leers+1.
Perhaps what would put @lauriii's mind at ease is if we marked
AddJsCommand@internalhere and un-marked it in #1988968: Drupal.ajax does not guarantee that "add new JS file to page" commands have finished before calling said JS? 🤔Also, #1988968 is major, has been around for more than a decade, and this blocks it. Updating issue metadata accordingly.
Comment #29
ruiadr commentedHello, this patch does not work as well.
In my case, I use s3 and store js & css on my bucket. When I am logged as administrator, for example, I can not use the form in the modal media.
To achieve this, I think you could replace PrependCommand and AppendCommand by AddJsCommand on this file AjaxResponseAttachmentsProcessor.php, like the first lines on this patch: https://www.drupal.org/files/issues/2022-01-25/1988968-268.patch
Without that, AddJsCommand is never used anywhere !
After this change, AJAX works like a charm. What do you think about that ?
Comment #30
megha_kundar commentedHI,
i see pr merged for branch 9.3.x. But not seeing changes in 9.4.x.
Can anyone confirm if these commits are present for 9.4.x branch as well ?
Comment #31
bartlangelaanRE #30
The MR is not merged yet, not for 9.3.x and not for 9.4.x.
Comment #32
nod_Merging the two patch by committer request to make it possible to review. Credits have been added to the other issue.