BU shows up multiple times on page

Created on 13 March 2021, over 3 years ago
Updated 4 August 2023, over 1 year ago

Problem/Motivation

BU will occasionally show up multiple times, especially in a sites front end. Here's a video: https://www.drupal.org/files/issues/2021-03-13/bu-dupe.mp4

Steps to reproduce

Install module, add #test-bu to url. Settings probably don't matter; I've included a .yml export anyway.

Proposed resolution

If bu has already been attached to the page, skip further calls during Drupal.behaviors.bu::attach()

Attached is a patch for bu.js and my patched version of bu.js

Patch wraps normal execution with:

if(typeof settings.bu.hooked === 'undefined'){
   // window.$buoop = { ... document.body.appendChild(e);
   settings.bu.hooked = true;
}

Remaining tasks

N/A?

User interface changes

none

API changes

drupalSettings.bu adds flag; drupalSettings.bu.hooked

Data model changes

none

🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

🇺🇸United States perfectcu.be

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024