Ensure the JavaScript behavior is executed only once per page

Created on 3 April 2025, 24 days ago

When the payment redirect page is loaded on modal dialog mode, the page opens up a half dozen modal dialogs at once, which causes obvious problems with rendering and processing payments. I haven't traced it out to see why the behaviors are attaching multiple times, but I'm assuming it's due to different contexts and our library not doing anything to ensure its code executes only once.

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States rszrama

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

Comments & Activities

  • Issue created by @rszrama
  • πŸ‡ΊπŸ‡ΈUnited States rszrama

    I hoped this would be a simple revision of the JavaScript behavior making use of Drupal core's once library, but that doesn't seem to solve the issue. Now instead of always getting 5 iframes, sometimes I get none, and sometimes I get 5. Will keep digging.

  • πŸ‡ΊπŸ‡ΈUnited States rszrama

    Turns out the library itself being included multiple times per page was the issue. I went ahead and converted all three JS libraries to remove jQuery and add Drupal's once to prevent multiple application of the behaviors. All works great now!

    • rszrama β†’ committed c51a01ec on 2.x
      Issue #3517170 by rszrama: Ensure the JavaScript behavior is executed...
Production build 0.71.5 2024