Skip to content

fix: keep preserveBehavior objects on main thread fallback - #790

Merged
gioboa merged 2 commits into
QwikDev:mainfrom
ArmenMesropyanOptimax:fix/fallback-preserve-behavior
Oct 14, 2026
Merged

gioboa merged 2 commits into
QwikDev:mainfrom
ArmenMesropyanOptimax:fix/fallback-preserve-behavior

Conversation

@ArmenMesropyanOptimax

Copy link
Copy Markdown
Contributor

Fixes #789

The main thread fallback deleted the top-level global of every forward entry, including dataLayer when dataLayer.push is forwarded with preserveBehavior: true, so everything pushed before the fallback was lost. It now keeps objects that have a nested property forwarded with preserveBehavior. Top-level stubs like fbq are still removed so their scripts can set them up again.

Added a unit test, and the fallback e2e page now forwards dataLayer.push with preserveBehavior and checks the data survives.

@changeset-bot

changeset-bot Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

馃 Changeset detected

Latest commit: 5893d66

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@qwik.dev/partytown Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@gioboa gioboa left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ArmenMesropyanOptimax nice fix 馃憦

@gioboa
gioboa merged commit 974bed8 into QwikDev:main Oct 14, 2026
6 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[馃悶] Fallback deletes dataLayer even when dataLayer.push is forwarded with preserveBehavior: true

2 participants