Problem/Motivation

quickedit.libraries.yml currently references a bunch of dependencies, including: backbone, popperjs, etc, all from core. I wonder if we should be declaring any of these dependencies ourselves, and if so, how:

  dependencies:
    - core/jquery
    - core/once
    - core/jquery.once.bc
    - core/underscore
    - core/backbone
    - core/jquery.form
    - core/drupal
    - core/drupal.displace
    - core/drupal.form
    - core/drupal.ajax
    - core/drupal.debounce
    - core/drupalSettings
    - core/drupal.dialog
    - core/popperjs

Proposed resolution

?

Remaining tasks

  1. Figure out what to do, if anything.
  2. Do it.
  3. Confirm it works.
  4. Commit.

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#3 3263769-3.slack_.txt2.92 KBdww

Issue fork quickedit-3263769

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dww created an issue. See original summary.

dww’s picture

Issue summary: View changes
dww’s picture

Priority: Critical » Normal
FileSize
2.92 KB

Based on the attached Slack exchange with @xjm, we agreed this shouldn't block 1.0.0 and can happen later. Core will give us proper deprecation warnings if/when any of our dependencies are going to be removed. Our tests should start failing with those deprecation warnings eventually, and we can decide to do a 1.1.0 or even 2.0.0 release when we have a new way to get our dependencies.

dww credited xjm.

dww’s picture

Wim Leers’s picture

As long as Drupal core contains these, it seems fine to depend on them?

phenaproxima’s picture

Priority: Normal » Critical

As long as Drupal core contains these, it seems fine to depend on them?

Sure, but core doesn't contain all of them anymore. Especially Underscore and Backbone, which are heavily used by Quick Edit, but which no longer appear in core.libraries.yml.

The short-term fix would be to change those dependencies to core/internal.backbone and core/internal.underscore, but they are explicitly marked as being liable to disappear at pretty much any time. Quick Edit should probably just redefine the required libraries and depend on them that way.

This issue therefore seems like it might be critical, since the module is already depending on libraries that don't exist except in Drupal 9.

Wim Leers’s picture

D'oh, I'd forgotten that Underscore and Backbone are gone in 10.0.x! 🙈

Quick Edit should probably just redefine the required libraries and depend on them that way.

Except that shipping those third party libraries directly with a contrib module (i.e. committed to the git repo) is not allowed by the Drupal.org policy: https://www.drupal.org/docs/develop/git/setting-up-git-for-drupal/drupal... 😬

The easiest path forward here is probably due to load them externally: https://www.drupal.org/docs/develop/git/setting-up-git-for-drupal/drupal...

phenaproxima’s picture

The easiest path forward here is probably due to load them externally

Yeah, that's what I meant by "redefine". Sorry, shoulda said! :)

phenaproxima’s picture

Assigned: Unassigned » phenaproxima

Self-assigning to implement.

phenaproxima’s picture

Status: Active » Needs review
Wim Leers’s picture

https://git.drupalcode.org/project/quickedit/-/merge_requests/13/diffs?c... → why add the file directly instead of again loading it externally? If merged, this would violate the d.o policy just like #3306909: Get Drupal Security Team approval to commit vendor/ckeditor.js to the drupal/ckeditor project — see https://www.drupal.org/docs/develop/git/setting-up-git-for-drupal/drupal....

But … here's a silver lining: why do we even need this? The reasoning for this dependency can be found in #3244855-10: Regression in Drupal 9.3.x due to jQuery.once deprecation. AFAICT, as long as tests pass without triggering JS deprecation warnings, we can just drop the jquery.once.bc dependency altogether!

AFAICT #3183149: Deprecate jquery.once and use the new once lib updated all of Quick Edit's uses of $.once() to use once() directly. So … we should be able to just delete it altogether. AFAICT this was just a universal solution that was blindly applied in #3244855: Regression in Drupal 9.3.x due to jQuery.once deprecation, but should not have been.

Assigning to @nod_ to review this, because he was closely involved in all of those issues :)

nod_’s picture

Assigned: nod_ » Unassigned

Yes please get rid of jQuery.once.bc, that was added for extra precautions and made sense while this was in core for code that implicitly depended on jQuery.once.

In contrib there is no reason to keep it around. Like Wim said the module already uses once without jQuery.

Wim Leers’s picture

Cool. But … it looks like something is still causing failures here.

@phenaproxima What's your analysis on the remaining failures? Is it related to Settings Tray?

phenaproxima’s picture

I don't know. Most of these don't fail for me on my localhost.

phenaproxima’s picture

Looks like these problems are due to HEAD being broken on 10.0.x: https://www.drupal.org/pift-ci-job/2469714

I suspect that this is due to the removal of Popper from core 10.0.x, which happened earlier today: https://git.drupalcode.org/project/drupal/-/commit/8398ea32a0c2d2006ec49...

phenaproxima’s picture

Whew. The 10.0.x failure is pre-existing in HEAD: https://www.drupal.org/pift-ci-job/2468637

@xjm informed me that Quick Edit is unlikely to be decoupled from Backbone/Underscore, and will probably just get EOLed. Therefore, it's safe to rely on the internal libraries.

This is ready for review.

phenaproxima’s picture

We should probably re-scope and re-title this to reflect the revelations from @xjm in #18.

Wim Leers’s picture

Status: Needs review » Needs work

I don't understand why we'd continue to rely on core/internal.* asset libraries?

Quoting core.libraries.yml:

internal.backbone:
  # Internal library. Do not depend on it outside core nor add new core usage.
  # The library will be removed as soon as the following issues are fixed:
  #  - https://www.drupal.org/project/drupal/issues/3203920
  #  - https://www.drupal.org/project/drupal/issues/3204011
  #  - https://www.drupal.org/project/drupal/issues/3204015

That means that at any point in time, i.e. once Contextual Links, Tour and Toolbar stop using Backbone & Underscore, that these libraries will disappear. I think it's safer to bring back the earlier commits that removed these dependencies in favor of locally declared externally loaded libraries?

OTOH … they would result in e.g. window._ being defined twice on some pages. Is that the concern here? I would agree with that. But then I think we should add @todo comments here, to help our future selves.

Wim Leers’s picture

Status: Needs work » Reviewed & tested by the community

Discussed this with @lauriii and @nod_:

OTOH … they would result in e.g. window._ being defined twice on some pages. Is that the concern here? I would agree with that. But then I think we should add @todo comments here, to help our future selves.

→ they agree with this. Meaning: A) ship this as-is now because it's the safer solution now, B) update this whenever a 10.x minor removes those core/internal.* libraries to instead use the CDN-based solution that @phenaproxima had in an earlier patch 👍

Wim Leers’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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