You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1) Clear pending callbacks before running them, so re-entrant hidden-page flushes can’t replay the same callback and overflow the stack.
2) Keep draining callbacks added during a hidden/pagehide flush, so work queued while the tab is hidden doesn’t get stuck behind a rAF that may never run.
3) Skip stale scheduled rAF/timeout continuations after a lifecycle flush already ran their callback.
4) Clear batched rAF callbacks before invoking them, so callbacks queued during a rAF drain are scheduled for the next frame instead of mutating the active iteration.
5) Run callbacks immediately if the tab becomes hidden while waiting for load, instead of scheduling rAF work in a hidden tab.
6) Rename pendingResolvers to pendingCallbacks, since this script stores synchronous work callbacks, not Promise resolvers.
7) Replace persistent __f mutation for history/submit wrappers with invocation-scoped tracking, so native methods run once per override chain without corrupting repeated calls.
Copy file name to clipboardExpand all lines: plugins/3rd-party-optimizer/yieldGTMCalls.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ When the inline script executes, it installs:
20
20
#### `MutationObserver` that waits for `dataLayer` to appear
21
21
22
22
- We need to wait for `dataLayer` to appear, so that the initial pushes happen as expected (e.g. `gtm.load`, `consent default`)
23
-
- Overrides `dataLayer.push` and `ga`/`gtag()` to yield first before calling the browser-native `push` function
23
+
- Overrides `dataLayer.push` and `gtag()` to yield first before calling the browser-native `push` function
24
24
- The override makes sure any further override is overridden again
25
25
- It yields between every overridden-call. This ensures we have natural yield points between the nested GTM tasks (that call `push` from within a `push`), ensuring tasks are split across multiple frames.
0 commit comments