Skip to content

fix: deep-clone postMessage payloads to avoid DataCloneError with framework proxies#139

Merged
behnam-oneschema merged 2 commits intomainfrom
devin/1773681686-fix-vue-reactive-proxy-postmessage
Mar 19, 2026
Merged

fix: deep-clone postMessage payloads to avoid DataCloneError with framework proxies#139
behnam-oneschema merged 2 commits intomainfrom
devin/1773681686-fix-vue-reactive-proxy-postmessage

Conversation

@behnam-oneschema
Copy link
Copy Markdown
Member

@behnam-oneschema behnam-oneschema commented Mar 17, 2026

Summary

Customer reported that upgrading @oneschema/vue from 0.6.x to 0.7.2 broke their production — Vue reactive Proxy objects in launch params (e.g. templateOverrides, customizationOverrides) cause a DataCloneError when postMessage attempts structured cloning on the iframe message.

This applies a JSON.parse(JSON.stringify(...)) deep-clone to the postMessage payload in both the Importer and FileFeeds #iframeEventEmit methods. This strips non-structurally-cloneable wrappers (like Vue's Proxy) before posting to the iframe.

The fix is in the core packages rather than the Vue wrapper so it is framework-agnostic and defensive against similar issues from other reactive frameworks.

Review & Testing Checklist for Human

  • Verify no message fields rely on undefined vs absent-key semanticsJSON.stringify omits object keys with undefined values (whereas structured clone preserves them as undefined). Check that the embed app's postMessage handler does not distinguish between a missing key and an explicit undefined.
  • Test with a Vue 3 app passing reactive templateOverrides/customizationOverrides to importer.launch() — confirm the DataCloneError no longer occurs and the import session initializes correctly.
  • Spot-check that non-Vue integrations (React, vanilla JS) still work — the JSON round-trip should be transparent for plain objects, but worth a quick sanity check.

Notes

  • The FileFeeds fix is proactive; the customer only reported the issue against the Importer, but the same postMessage pattern exists in FileFeeds.
  • JSON.parse(JSON.stringify(...)) will also drop any Date, RegExp, or function values — these types don't appear in the current payload interfaces, but worth being aware of if the message shape evolves.
  • There are currently no automated tests in this repo for either package, so this change is untested beyond lint.

Link to Devin session: https://app.devin.ai/sessions/71ec3b816ec04b519a0dd348218fd107
Requested by: @behnam-oneschema

@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@oneschema oneschema deleted a comment from devin-ai-integration Bot Mar 17, 2026
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@behnam-oneschema behnam-oneschema marked this pull request as ready for review March 19, 2026 20:51
behnam-oneschema and others added 2 commits March 19, 2026 14:03
…mework proxies

Vue reactive Proxy objects passed as launch params (e.g. templateOverrides,
customizationOverrides) cause a DataCloneError when postMessage attempts
structured cloning. This applies a JSON round-trip to strip
non-structurally-cloneable wrappers before posting to the iframe.

Fixes both the Importer and FileFeeds packages.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@behnam-oneschema behnam-oneschema force-pushed the devin/1773681686-fix-vue-reactive-proxy-postmessage branch from 4a6b8a6 to 07c15e7 Compare March 19, 2026 21:03
@behnam-oneschema behnam-oneschema merged commit 57659b6 into main Mar 19, 2026
1 check was pending
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.

2 participants