shs_select2: error self.dataAdapter is NULL

Created on 28 June 2024, 7 months ago

Problem/Motivation

When I use shs_select2 module (2.0@RC) with select2 (4.0.13) I observe error in console related to the fact, that dataAdapter is NULL. In general all works, but this error is visible in console.

Steps to reproduce

  1. On taxonomy reference field use widget Simple hierarchical select: Select2 (options_shs_select2)
  2. Select option on level 0.

After these steps I see this error in console:

TypeError: Cannot read properties of null (reading 'current')
    at HTMLSelectElement.<anonymous> (select2.min.js?sfsk82:2:61796)
    at HTMLSelectElement.dispatch (jquery.min.js?v=3.7.1:2:40035)
    at v.handle (jquery.min.js?v=3.7.1:2:38006)
    at Object.trigger (jquery.min.js?v=3.7.1:2:70124)
    at HTMLSelectElement.<anonymous> (jquery.min.js?v=3.7.1:2:70726)
    at Function.each (jquery.min.js?v=3.7.1:2:3129)
    at ce.fn.init.each (jquery.min.js?v=3.7.1:2:1594)
    at ce.fn.init.trigger (jquery.min.js?v=3.7.1:2:70701)
    at n.select (select2.min.js?sfsk82:2:33692)
    at d.<anonymous> (select2.min.js?sfsk82:2:34502)

It looks like, that for some reason dataAdapter here is NULL:

d.prototype._registerDomEvents = function() {
                var t = this;
                this.$element.on("change.select2", function() {
                    t.dataAdapter.current(function(e) {
                        t.trigger("selection:update", {
                            data: e
                        })
                    })
                }),

Proposed resolution

I tried to debug, but without success. I have no idea what's wrong. Maybe someone has idea and can help.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇵🇱Poland gugalamaciek

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

Comments & Activities

Production build 0.71.5 2024