Content edit : Ajax update of the right panel doesn't work on Drupal 9.x

Created on 22 April 2023, over 1 year ago
Updated 7 November 2023, about 1 year ago

Problem/Motivation

While editing a content, the information in the right panel doesn't update on term change.
I get a JS error : this.document.querySelector(...) is null

The selector '#edit-permissions-by-term-info .js-form-type-item' doesn't match the DOM structure.
Mine would be : '#edit-permissions-by-term-info .details-wrapper'

Steps to reproduce

* Edit a content
* Open the right panel "Permission by term" to see the content
* Edit The taxonomy field to change permissions
* The panel doesn't change
* A Javascript error occurs in the console

Proposed resolution

The following commit should probably be improved : https://git.drupalcode.org/project/permissions_by_term/-/commit/ba4835a6...

Remaining tasks

🐛 Bug report
Status

Active

Version

3.1

Component

Code

Created by

🇫🇷France emmguyot

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @emmguyot
  • I too am having a similar problem. I have not had the time to really dive into webpack. I have not used that before. But it appears to be looking for a DOM element that doesn't exist. The other issue that is happening is with the Chosen module. This function must be running on any select change. I get the same error when I am simply using a chosen select. Once the error occurs, all JS is stopped, so nothing else on the page will function either. The details of the message are not too helpful, but :

    Uncaught TypeError: this.document.querySelector(...) is null
        setDivHtmlByClassSelector /modules/contrib/permissions_by_term/js/webpack-dist/bundle.js?v=9.5.9:8
        renderPermissionsInfo /modules/contrib/permissions_by_term/js/webpack-dist/bundle.js?v=9.5.9:8
        r /modules/contrib/permissions_by_term/js/webpack-dist/bundle.js?v=9.5.9:1
        t /modules/contrib/permissions_by_term/js/webpack-dist/bundle.js?v=9.5.9:1
        jQuery 2
            dispatch
            handle
    bundle.js:8:17670
    

    I attempted to downgrade to 3.1.21 but that did not solve the problem for me.

    If anyone can provide any "How-Tos" on setting up webpack, that would be helpful for me.

    Thanks.

  • 🇫🇷France alexander94

    I have a similar error with the last version of permissions by term :

    this[(intermediate value)[r]] is not a function

    I tried to use different display modes for tag field (autocomplete, checkbox, select) but the error persists.

    Permissions are saved in the database when submitting form.

Production build 0.71.5 2024