Skip to content

fix(core): prevent null select in scenario templates after async load#3253

Open
Zyg0m4t1k wants to merge 1 commit intojeedom:developfrom
Zyg0m4t1k:fix/scenario-select-null
Open

fix(core): prevent null select in scenario templates after async load#3253
Zyg0m4t1k wants to merge 1 commit intojeedom:developfrom
Zyg0m4t1k:fix/scenario-select-null

Conversation

@Zyg0m4t1k
Copy link
Copy Markdown

🐛 Bug

Scenario templates use async loading (allOrderedByGroupObjectName) and manipulate a <select> element.

If the DOM changes (modal closed, navigation, reload), the <select> may no longer exist when the AJAX response returns.

This causes a JS error:

  • select is null
  • appendChild fails

✅ Fix

  • Re-query the DOM inside the async callback
  • Add guard:
if (!select) return;

@Mips2648
Copy link
Copy Markdown
Collaborator

Hello,

You wrote that the fix consist in "re-query the DOM" (+ add guard) but in the code the query was already there;
Could you clarify what you mean? or was it the IA that was a bit too optimist?

Could you please describe how we can reproduce the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants