Problem/Motivation

Steps to reproduce

Updating module from 3.1.30 to higher versions giving error when deselecting the terms inside node edit page .

  1. Install and configure the 3.1.30 version of the module.
  2. After configuring and adding permissions to the terms update the module to higher versions like 3.1.33
  3. Go to node edit page which has taxonomy reference field added with multiple choices.
  4. Add some terms and try to remove those terms you will not able to remove selected terms.
  5. Check the console
  6. z

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

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

someshver created an issue. See original summary.

_kash_’s picture

I encountered this error while the autocomplete is being populated with text.

The error does not happen with core 10.2.5 installed.

I only see it when I update to 10.2.6.

Module version "drupal/permissions_by_term": "3.1.31"

It looks like the screenshot from someshver also shows the version at 10.2.6 https://www.drupal.org/files/issues/2024-05-13/Untitled.png

_kash_’s picture

Full js error output

bundle.js?v=10.2.6:8 Uncaught TypeError: this[{(intermediate value)(intermediate value)(intermediate value)}[r]] is not a function
at u.computeTids (bundle.js?v=10.2.6:8:10308)
at n (bundle.js?v=10.2.6:1:101244)
at HTMLInputElement. (bundle.js?v=10.2.6:1:101687)
at HTMLInputElement.dispatch (jquery.min.js?v=3.7.1:2:40035)
at v.handle (jquery.min.js?v=3.7.1:2:38006)
u.computeTids @ bundle.js?v=10.2.6:8
n @ bundle.js?v=10.2.6:1
(anonymous) @ bundle.js?v=10.2.6:1
dispatch @ jquery.min.js?v=3.7.1:2
v.handle @ jquery.min.js?v=3.7.1:2
bundle.js?v=10.2.6:8 Uncaught TypeError: this[{(intermediate value)(intermediate value)(intermediate value)}[r]] is not a function
at u.computeTids (bundle.js?v=10.2.6:8:10308)
at n (bundle.js?v=10.2.6:1:101244)
at HTMLInputElement. (bundle.js?v=10.2.6:1:101687)
at HTMLInputElement.dispatch (jquery.min.js?v=3.7.1:2:40035)
at v.handle (jquery.min.js?v=3.7.1:2:38006)
u.computeTids @ bundle.js?v=10.2.6:8
n @ bundle.js?v=10.2.6:1
(anonymous) @ bundle.js?v=10.2.6:1
dispatch @ jquery.min.js?v=3.7.1:2
v.handle @ jquery.min.js?v=3.7.1:2
bundle.js?v=10.2.6:8 Uncaught TypeError: this[{(intermediate value)(intermediate value)(intermediate value)}[r]] is not a function
at u.computeTids (bundle.js?v=10.2.6:8:10308)
at n (bundle.js?v=10.2.6:1:101244)
at HTMLInputElement. (bundle.js?v=10.2.6:1:101687)
at HTMLInputElement.dispatch (jquery.min.js?v=3.7.1:2:40035)
at v.handle (jquery.min.js?v=3.7.1:2:38006)
u.computeTids @ bundle.js?v=10.2.6:8
n @ bundle.js?v=10.2.6:1
(anonymous) @ bundle.js?v=10.2.6:1
dispatch @ jquery.min.js?v=3.7.1:2
v.handle @ jquery.min.js?v=3.7.1:2

brunoalmeida’s picture

Assigned: Unassigned » brunoalmeida
Status: Active » Needs work

brunoalmeida’s picture

Assigned: brunoalmeida » Unassigned
Status: Needs work » Needs review

This issue happens when the Drupal field wrapper has a select and an input field. That's the typical scenario when using the "chosen" library, 'cos it will have the select default field plus the "chosen" html inputs. The DomClient._getInputType is getting lost 'cos it will find first a select and after an input, which will make the function return 'undefined' causing the error mentioned above. I created a 'else if' condition to avoid this issue.

_kash_’s picture

I tried applied the diff as a patch. It applied cleanly to 3.1.33 but it did not work for me. Still seeing the error. FWIW I am not using the chosen module. I am using the Autocomplete (Tag style) widget.

brunoalmeida’s picture

_KASH_ could you please attach a screenshot of your field with this widget? I changed the widget from chosen to Autocomplete (Tag style) and it's working as expected here.

_kash_’s picture

StatusFileSize
new108.94 KB

I've attached a screenshot along side the error.
The field actually works still. However the js error is causing my tests to fail. So I need to fix the js error.

I am narrowing down the cause.

I've successfully updated Core to 10.2.7 and PBT to 3.1.33 and the tests pass (there is no JS error) There is still a JS error.

However, when I do a composer update for the rest of the modules that need to be brought up to date, that is when I start to encounter the error failed tests.

So, it seem that the error failed test is somehow related to one of these updates included below. There is a possibility this bug does not even reside with permissions by term.

I am going to try to figure out which package update introduces the error. Could take a while...

composer update --dry-run
Loading composer repositories with package information
Updating dependencies
Lock file operations: 7 installs, 45 updates, 3 removals
- Removing phenx/php-font-lib (0.5.6)
- Removing phenx/php-svg-lib (0.5.4)
- Removing textalk/websocket (1.5.8)
- Upgrading chi-teck/drupal-code-generator (3.5.0 => 3.6.0)
- Upgrading composer/class-map-generator (1.1.1 => 1.3.3)
- Upgrading composer/composer (2.7.2 => 2.7.7)
- Upgrading composer/pcre (3.1.3 => 3.1.4)
- Upgrading composer/xdebug-handler (3.0.4 => 3.0.5)
- Upgrading dmore/chrome-mink-driver (2.9.2 => 2.9.3)
- Upgrading doctrine/event-manager (2.0.0 => 2.0.1)
- Upgrading dompdf/dompdf (v2.0.7 => v3.0.0)
- Locking dompdf/php-font-lib (1.0.0)
- Locking dompdf/php-svg-lib (1.0.0)
- Upgrading drevops/behat-steps (2.2.0 => 2.3.0)
- Upgrading drupal/better_exposed_filters (6.0.3 => 6.0.6)
- Upgrading drupal/coder (8.3.23 => 8.3.24)
- Upgrading drupal/collapsiblock (4.1.0 => 4.2.0)
- Upgrading drupal/core-dev (10.2.5 => 10.2.7)
- Upgrading drupal/entity_print (2.13.0 => 2.14.0)
- Upgrading drupal/google_tag (2.0.4 => 2.0.5)
- Upgrading drupal/jquery_ui (1.6.0 => 1.7.0)
- Upgrading drupal/jquery_ui_datepicker (2.0.0 => 2.1.0)
- Upgrading drupal/jquery_ui_slider (2.0.0 => 2.1.0)
- Upgrading drupal/jquery_ui_touch_punch (1.1.0 => 1.1.1)
- Locking drupal/js_cookie (1.0.1)
- Upgrading drupal/key (1.17.0 => 1.18.0)
- Upgrading drupal/tfa (1.6.0 => 1.7.0)
- Upgrading drupal/upgrade_status (4.2.0 => 4.3.2)
- Upgrading drupal/views_bulk_operations (4.2.6 => 4.2.7)
- Upgrading drush/drush (12.5.1 => 12.5.2)
- Upgrading grasmash/yaml-cli (3.2.0 => 3.2.1)
- Upgrading league/csv (9.15.0 => 9.16.0)
- Upgrading mglaman/phpstan-drupal (1.2.10 => 1.2.11)
- Upgrading onelogin/php-saml (4.1.0 => 4.2.0)
- Upgrading paragonie/constant_time_encoding (v2.6.3 => v2.7.0)
- Upgrading phpstan/extension-installer (1.3.1 => 1.4.1)
- Upgrading phpstan/phpstan (1.10.67 => 1.11.4)
- Upgrading phpstan/phpstan-deprecation-rules (1.1.4 => 1.2.0)
- Upgrading phpstan/phpstan-phpunit (1.3.16 => 1.4.0)
- Locking phrity/net-stream (1.3.0)
- Locking phrity/net-uri (1.3.0)
- Locking phrity/util-errorhandler (1.1.0)
- Locking phrity/websocket (1.7.3)
- Upgrading psy/psysh (v0.12.3 => v0.12.4)
- Upgrading react/promise (v3.1.0 => v3.2.0)
- Upgrading squizlabs/php_codesniffer (3.9.1 => 3.10.1)
- Upgrading symfony/browser-kit (v6.4.3 => v6.4.8)
- Upgrading symfony/config (v6.4.6 => v6.4.8)
- Upgrading symfony/css-selector (v6.4.3 => v6.4.8)
- Upgrading symfony/dom-crawler (v6.4.4 => v6.4.8)
- Upgrading symfony/http-client (v6.4.6 => v6.4.8)
- Upgrading symfony/lock (v6.4.6 => v6.4.8)
- Upgrading symfony/phpunit-bridge (v6.4.6 => v6.4.8)
- Upgrading symfony/translation (v6.4.4 => v6.4.8)
- Upgrading webflo/drupal-finder (1.2.2 => 1.3.0)
Installing dependencies from lock file (including require-dev)
Package operations: 7 installs, 45 updates, 3 removals
- Removing textalk/websocket (1.5.8)
- Removing phenx/php-svg-lib (0.5.4)
- Removing phenx/php-font-lib (0.5.6)
- Upgrading phpstan/phpstan (1.10.67 => 1.11.4)
- Upgrading phpstan/extension-installer (1.3.1 => 1.4.1)
- Upgrading symfony/http-client (v6.4.6 => v6.4.8)
- Upgrading symfony/dom-crawler (v6.4.4 => v6.4.8)
- Upgrading symfony/css-selector (v6.4.3 => v6.4.8)
- Upgrading symfony/browser-kit (v6.4.3 => v6.4.8)
- Upgrading composer/pcre (3.1.3 => 3.1.4)
- Upgrading composer/class-map-generator (1.1.1 => 1.3.3)
- Upgrading composer/xdebug-handler (3.0.4 => 3.0.5)
- Upgrading symfony/config (v6.4.6 => v6.4.8)
- Upgrading symfony/translation (v6.4.4 => v6.4.8)
- Installing phrity/util-errorhandler (1.1.0)
- Installing phrity/net-uri (1.3.0)
- Installing phrity/net-stream (1.3.0)
- Installing phrity/websocket (1.7.3)
- Upgrading dmore/chrome-mink-driver (2.9.2 => 2.9.3)
- Upgrading doctrine/event-manager (2.0.0 => 2.0.1)
- Installing dompdf/php-font-lib (1.0.0)
- Installing dompdf/php-svg-lib (1.0.0)
- Upgrading webflo/drupal-finder (1.2.2 => 1.3.0)
- Upgrading drevops/behat-steps (2.2.0 => 2.3.0)
- Upgrading drupal/jquery_ui (1.6.0 => 1.7.0)
- Upgrading drupal/jquery_ui_touch_punch (1.1.0 => 1.1.1)
- Upgrading drupal/jquery_ui_slider (2.0.0 => 2.1.0)
- Upgrading drupal/jquery_ui_datepicker (2.0.0 => 2.1.0)
- Upgrading drupal/better_exposed_filters (6.0.3 => 6.0.6)
- Installing drupal/js_cookie (1.0.1)
- Upgrading drupal/collapsiblock (4.1.0 => 4.2.0)
- Upgrading symfony/phpunit-bridge (v6.4.6 => v6.4.8)
- Upgrading symfony/lock (v6.4.6 => v6.4.8)
- Upgrading phpstan/phpstan-phpunit (1.3.16 => 1.4.0)
- Upgrading phpstan/phpstan-deprecation-rules (1.1.4 => 1.2.0)
- Upgrading mglaman/phpstan-drupal (1.2.10 => 1.2.11)
- Upgrading squizlabs/php_codesniffer (3.9.1 => 3.10.1)
- Upgrading drupal/coder (8.3.23 => 8.3.24)
- Upgrading react/promise (v3.1.0 => v3.2.0)
- Upgrading composer/composer (2.7.2 => 2.7.7)
- Upgrading drupal/core-dev (10.2.5 => 10.2.7)
- Upgrading dompdf/dompdf (v2.0.7 => v3.0.0)
- Upgrading drupal/entity_print (2.13.0 => 2.14.0)
- Upgrading drupal/google_tag (2.0.4 => 2.0.5)
- Upgrading drupal/key (1.17.0 => 1.18.0)
- Upgrading psy/psysh (v0.12.3 => v0.12.4)
- Upgrading grasmash/yaml-cli (3.2.0 => 3.2.1)
- Upgrading chi-teck/drupal-code-generator (3.5.0 => 3.6.0)
- Upgrading drush/drush (12.5.1 => 12.5.2)
- Upgrading onelogin/php-saml (4.1.0 => 4.2.0)
- Upgrading paragonie/constant_time_encoding (v2.6.3 => v2.7.0)
- Upgrading drupal/tfa (1.6.0 => 1.7.0)
- Upgrading drupal/upgrade_status (4.2.0 => 4.3.2)
- Upgrading drupal/views_bulk_operations (4.2.6 => 4.2.7)
- Upgrading league/csv (9.15.0 => 9.16.0)

_kash_’s picture

Well, I've done some more digging and found my issue.

Upgrading dmore/chrome-mink-driver (2.9.2 => 2.9.3)

That causes my tests to fail from the JS error.

The JS error seems to exist in my current build as well... sometimes

Uncaught TypeError: this[{(intermediate value)(intermediate value)(intermediate value)}[r]] is not a function
at u.computeTids (bundle.js?v=10.2.5:8:10308)
at n (bundle.js?v=10.2.5:1:101244)
at HTMLInputElement. (bundle.js?v=10.2.5:1:101687)
at HTMLInputElement.dispatch (jquery.min.js?v=3.7.1:2:40035)
at v.handle (jquery.min.js?v=3.7.1:2:38006)

I am going to pin chrome-mink-driver to 2.9.2 and move on for now...

someshver’s picture

It is working perfectly with the version 3.1.30. So I think we need to compare the module with the older version to see what is changed on the newer versions. Currently I am not updating this module till the issue is not fixed.

igor mashevskyi made their first commit to this issue’s fork.

igor mashevskyi’s picture

I encountered the same issue. The patch https://git.drupalcode.org/project/permissions_by_term/-/merge_requests/... resolved the problem for some content edit form pages, but I continued experiencing the issue with other content types. Upon further investigation, I discovered that this error occurs when certain taxonomy fields are not displayed in the form.

After the latest changes in the patch, the issue should now be resolved.

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

marcoliver’s picture

Hi! I just updated the issue for against the latest state of 3.1.x-dev.

Can someone involved with this issue please verify that the issue fork still works for them?

lester-barahona made their first commit to this issue’s fork.

lester-barahona’s picture

@marcoliver I've tried but can't build the js code properly, for some reason in the js code all the boolean variables and null are in uppercase for example in webpack.js devtool: FALSE and should be false, I think it could be related with some of the last updateds for the Drupal 11 support:

https://git.drupalcode.org/project/permissions_by_term/-/commit/9beaf406...

lester-barahona’s picture

StatusFileSize
new115.91 KB

Please take a look on this patch

And merge request https://git.drupalcode.org/project/permissions_by_term/-/merge_requests/57

lester-barahona’s picture

marcoliver’s picture

Assigned: Unassigned » marcoliver
Status: Needs review » Active
marcoliver’s picture

Status: Active » Fixed

Thanks, @lester-barahona, merging this!

jepster_’s picture

Thanks! This is now part of the 3.1.37 patch release: https://www.drupal.org/project/permissions_by_term/releases/3.1.37

Status: Fixed » Closed (fixed)

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