- 🇨🇴Colombia jedihe
In cookies_gtag.js, I'm seeing the event listener registering twice on page load; then 2 more registrations occur after each AJAX update:
Right After Page Load:
Right After an AJAX Refresh:
I think it is totally possible to properly handle the various scenarios mentioned by @JFeltkamp without having this bad side-effect. Proper usage of core/once should suffice for this, maybe accompanying it with an early (outside of the behavior attach method) registration of the listener.
- Issue was unassigned.
- Status changed to Needs work
over 1 year ago 7:47am 21 June 2023 - 🇩🇪Germany Anybody Porta Westfalica
@jedihe thanks for the investigations, I totally agree we should try to fix this. I'm not even sure, if "once" is needed or this can be done simpler. The reason behind is simply, that attach() is called on each ajax request, with the given context to load.
While the context is == document on initial load, it's the AJAX content added on subsequent loads.
I don't have the time to implement or check this deeper currently, could you prepare a MR? Then I'll be happy to review.