fix: enable strictProxyHas for namespace conflict detection in window proxy#692
Merged
thejackshelton merged 2 commits intoQwikDev:mainfrom Mar 2, 2026
Merged
Conversation
🦋 Changeset detectedLatest commit: c251ee3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
… proxy - Add strictProxyHas config option to PartytownConfig for accurate 'in' operator behavior - Update window proxy has trap to check config flag and use Reflect.has when enabled - Add FullStory GTM integration test with exact production snippet - Document strictProxyHas in configuration docs - Add FullStory to common services with GTM configuration guide - Add test-results to .gitignore to prevent committing test artifacts This fixes the issue where FullStory loaded via GTM would detect a false 'namespace conflict' because the window proxy's 'in' operator always returned true. With strictProxyHas enabled, scripts can accurately check for property existence using the 'in' operator while maintaining backwards compatibility for existing implementations.
ef3d8b2 to
d193ddf
Compare
Contributor
Author
|
The CI failure is a main branch issue (pre-existing formatting problems) and not related to my changes. |
thejackshelton
approved these changes
Mar 2, 2026
Member
There was a problem hiding this comment.
LGTM as a nice user facing bug fix. Note: The CI lint failure is pre-existing on main, not related to this PR. Will merge and release soon.
Also apologies for the wait @chadgauth 😅 . Will be more active going forward.
This was referenced Mar 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use cases and why
This PR fixes a critical compatibility issue with FullStory analytics when loaded via Google Tag Manager (GTM) through Partytown. This is important for users who:
Use FullStory analytics with GTM integration - FullStory fails to initialize when GTM injects the script tag with
type="text/partytown", blocking session recording and user analytics entirelyNeed accurate namespace conflict detection in web workers - Any third-party script that checks for property existence using the
inoperator (e.g.,if (!("libraryName" in window))) will benefit from having accurate checks instead of always returningtrueRequire opt-in fixes without breaking existing implementations - Developers can enable
strictProxyHas: trueonly for scripts that need it, while maintaining full backwards compatibility with existing Partytown configurationsProblem Statement
When FullStory is loaded via GTM's Custom HTML tag through Partytown, it fails to initialize with a "namespace conflict" error. This occurs because:
if (!("FS" in window))has: () => true- always returning true regardless of actual property existenceSolution
Added a new configuration option
strictProxyHasthat allows accurate namespace conflict detection:true: Theinoperator usesReflect.has()for accurate property checksfalse(default): Maintains existing behavior for backwards compatibilityChanges Made
Code
src/lib/types.ts- AddedstrictProxyHas?: booleanto PartytownConfig with JSDocsrc/lib/web-worker/worker-window.ts- Updated window proxy'shastrap to conditionally useReflect.has()Tests
tests/integrations/full-story/full-story.spec.ts- Updated with new "full-story via GTM" test casetests/integrations/full-story/gtm-fullstory.html- New integration test using exact production FullStory snippet from GTMDocumentation
docs/src/routes/configuration/index.mdx- AddedstrictProxyHasto configuration tabledocs/src/routes/common-services/index.mdx- Added FullStory with GTM configuration guide and dedicated sectionInfrastructure
.gitignore- Addedtest-results/to prevent committing Playwright test artifacts.changeset/strict-proxy-has.md- Changeset for version bumpTesting
✅ FullStory GTM Integration Test: New test passes with
strictProxyHas: true✅ Full Test Suite: 55/57 tests passing (2 pre-existing failures in error handling and mutation-observer, unrelated to this change)
✅ No Regressions: All previously passing tests continue to pass
✅ Backwards Compatible: Default behavior (
strictProxyHas: false) unchangedHow Users Can Use This
Checklist: