Some of my Drupal behaviors are firing multiple times while as a logged-in user:
(function myFunction (Drupal) {
"use strict";
Drupal.behaviors.myBehavior = {
attach: function attach (context) {
console.log("Hello world");
}
};
}(Drupal));
The above will log "Hello world" multiple times in console while logged in, only once while logged out.
I've been working through updating scripts to use Drupal's once()
library, but am unsure if this is the fix or just a patch.
Is there a higher context I could look at that might be causing this? I'm unsure of the difference between logged-in and logged-out here.