Error: cannot call methods on dialog prior to initialization; attempted to call method 'option'

Created on 6 September 2024, 6 months ago

Problem/Motivation

I'm seeing this error in our project CI with drupal dialogs:

Error: cannot call methods on dialog prior to initialization; attempted to call method 'option'

This happens when opening and immediately closing a modal (very fast, with js).
It's quite easy to reproduce with some JS code (click button to open modal, wait for .ui-dialog element to exist, and immediately close modal with cancel/close button).

Steps to reproduce

TODO (provide FunctionalJavascript test)

Proposed resolution

It seems that in such cases, Drupal.dialog.resetSize is called from debounce after the jquery dialog instance has been destroyed. This happens within 20ms (debounce/setTimeout interval).

Add a check ensuring we have a valid jquery dialog instance at the top of Drupal.dialog.resetSize.

Remaining tasks

?

User interface changes

None

Introduced terminology

None

API changes

None

Data model changes

None

Release notes snippet

None

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
JavascriptΒ  β†’

Last updated about 12 hours ago

Created by

πŸ‡§πŸ‡ͺBelgium herved

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024