Problem/Motivation

Just updated Gin to RC1 - congrats to this great step Sascha - but unfortunately, we're getting some javascript observer exception in the browser which doesn't seem to do any harm normally, but Cypress fails with an exception I had never seen before: Failed to execute 'observe' on 'IntersectionObserver': parameter 1 is not of type 'Element'.

There is also the following stacktrace available:

This behavior is configurable, and you can choose to turn this off by listening to the `uncaught:exception` event.
    at <unknown> (https://www.example.com/themes/contrib/gin/dist/js/sticky.js?rm3ryk:10:12)
    at Array.forEach (<anonymous>)
    at Object.attach (https://www.example.com/themes/contrib/gin/dist/js/sticky.js?rm3ryk:4:78)
    at <unknown> (https://www.example.com/core/misc/drupal.js?v=9.4.8:27:24)
    at Array.forEach (<anonymous>)
    at Drupal.attachBehaviors (https://www.example.com/core/misc/drupal.js?v=9.4.8:24:34)
    at HTMLUListElement.<anonymous> (https://www.example.com/core/misc/ajax.js?v=9.4.8:569:20)
    at Function.each (https://www.example.com/core/assets/vendor/jquery/jquery.min.js?v=3.6.0:2:3003)
    at S.fn.init.each (https://www.example.com/core/assets/vendor/jquery/jquery.min.js?v=3.6.0:2:1481)
    at Drupal.AjaxCommands.insert (https://www.example.com/core/misc/ajax.js?v=9.4.8:567:21)

Downgrading to beta5 solves the problem. Not sure if the above information is enough to find the issue. If you need any more information, I'm happy to investigate.

Issue fork gin-3324320

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

jurgenhaas created an issue. See original summary.

saschaeggi’s picture

Status: Active » Postponed

Hey @jurgenhaas
We removed jQuery a while ago in the dev branch and moved to use vanilla JS. We also did some refactoring and indeed use an Observer. There is no way to remove the Observer.

If you can provide a patch to make it work with Cypress I'm happy to review & merge.

jurgenhaas’s picture

Status: Postponed » Needs review

As you can most certainly tell from the code in MR 201, I'm not a javascript expert. But at least that change resolves the problem as it verifies, if context.querySelector(".region-sticky-watcher") returns an element before using it with the observer.

saschaeggi’s picture

Status: Needs review » Needs work

@jurgenhaas the MR is missing source file(s).

jurgenhaas’s picture

Status: Needs work » Needs review

I wish I knew what I'm doing ;-) Please have another look.

  • fca4e03 committed on 8.x-3.x
    Issue #3324320: RC1 breaks Cypress Tests
    
saschaeggi’s picture

Status: Needs review » Fixed

Fixed 🎉

jurgenhaas’s picture

Thanks you !!!

Status: Fixed » Closed (fixed)

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