Problem/Motivation

When upgrading Drupal to v11, the BigPipe core module breaks SHS.

Steps to reproduce

js/shs.js looks for appModel class that is defined in js/AppModel.js file but that file in Drupal 11 with BigPipe enabled is loaded AFTER shs.js so shs.js throws an error and the widget is not shown

Proposed resolution

Make it compatible with BigPipe in Drupal 11

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork shs-3495590

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:

Comments

giuse69 created an issue. See original summary.

shivam_tiwari made their first commit to this issue’s fork.

joseph.olstad’s picture

Status: Active » Needs work
catch’s picture

https://git.drupalcode.org/project/shs/-/blob/2.0.x/shs.libraries.yml?re...

js:
    js/shs.js: {weight: -1}
    # Models.
    js/models/AppModel.js: {}
    js/models/ContainerModel.js: {}
    js/models/WidgetModel.js: {}
    js/models/WidgetItemModel.js: {}
    js/models/WidgetItemOptionModel.js: {}
    # Views.
    js/views/AppView.js: {}
    js/views/AddNewView.js: {}
    js/views/ContainerView.js: {}
    js/views/WidgetView.js: {}
    js/views/WidgetItemView.js: {}

js/shs.js is defined with weight -1 which means that it would be loaded before all the other files in the library, removing the weight might be enough?

This is probably #3467860: Ensure consistent ordering when calculating library asset order (in 11.1 and 10.4) rather than bigpipe specifically.

joseph.olstad’s picture

Hmm, thanks @catch! :)

ok, so probably need to update the .info.yml for shs

diff --git a/shs.info.yml b/shs.info.yml
index df1507c..b0b5f77 100644
--- a/shs.info.yml
+++ b/shs.info.yml
@@ -2,7 +2,7 @@ name: Simple Hierarchical Select
 type: module
 description: 'Creates a simple hierarchical select widget for taxonomy fields.'
 dependencies:
-  - drupal:system (>=10.2)
+  - drupal:system (>=10.4)
   - drupal:taxonomy
-core_version_requirement: ^10.2 || ^11
+core_version_requirement: ^10.4 || ^11.1
 package: User interface

like this ? ^

catch’s picture

Well the question is, why is the weight -1 set?

 js/shs.js: {weight: -1}

If the module works without it (or can be made to work without it), then it should work across Drupal versions and not require increasing the requirements at all.

Normally, if a file depends on other files in the same library, you would put it further down in the list of files too - iirc we load files in the order they're listed, and not specify a weight.

  • joseph.olstad committed 9de75597 on 3.0.x
    Issue #3495590 by shivam_tiwari, catch, giuse69: Incompatible with...

  • joseph.olstad committed 2975ee24 on 2.0.x
    Issue #3495590 by shivam_tiwari, catch, giuse69: Incompatible with...
joseph.olstad’s picture

Version: 3.0.x-dev » 2.0.x-dev
joseph.olstad’s picture

joseph.olstad’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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