Replace @ungap/structured-clone with native structuredClone#26890
Merged
ChumpChief merged 5 commits intomicrosoft:mainfrom Apr 14, 2026
Merged
Replace @ungap/structured-clone with native structuredClone#26890ChumpChief merged 5 commits intomicrosoft:mainfrom
ChumpChief merged 5 commits intomicrosoft:mainfrom
Conversation
Native structuredClone is available in all supported environments (Node 20+ and ES2022 browsers). Remove the polyfill from app-insights-logger, container-loader, and tree. In tree, the internal clone re-export is removed and the one test consumer is updated to use structuredClone directly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the @ungap/structured-clone polyfill (and its types) and switches call sites to the native global structuredClone, relying on the repo’s supported runtime environments where it is available.
Changes:
- Removed
@ungap/structured-cloneand@types/ungap__structured-clonedependencies fromcontainer-loader,app-insights-logger, andtree(and updated lockfile). - Updated
container-loaderandapp-insights-loggerto use the globalstructuredClone(no import). - Removed the internal
clonere-export fromtreeutils and updated the one test consumer to callstructuredClonedirectly.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Removes lock entries for @ungap/structured-clone and its types from affected importers. |
| packages/loader/container-loader/src/container.ts | Drops the polyfill import; continues cloning via global structuredClone. |
| packages/loader/container-loader/package.json | Removes @ungap/structured-clone and @types/ungap__structured-clone. |
| packages/framework/client-logger/app-insights-logger/src/fluidAppInsightsLogger.ts | Drops the polyfill import; continues deep-copying config via global structuredClone. |
| packages/framework/client-logger/app-insights-logger/package.json | Removes @ungap/structured-clone and @types/ungap__structured-clone. |
| packages/dds/tree/src/util/utils.ts | Removes internal clone re-export of the polyfill. |
| packages/dds/tree/src/util/index.ts | Stops re-exporting clone from util barrel. |
| packages/dds/tree/src/test/shared-tree-core/edit-manager/editManagerScenario.ts | Updates test to use global structuredClone instead of util clone. |
| packages/dds/tree/package.json | Removes @ungap/structured-clone and @types/ungap__structured-clone. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Contributor
Author
|
Moving back to draft while confirming browser support requirements. |
The jsdom environment doesn't provide structuredClone. Now that container-loader uses native structuredClone instead of the @ungap/structured-clone polyfill, it needs to be explicitly exposed in the Jest config globals. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Updated downstream browser support requirements, structuredClone should be fine to use as a result. |
alexvy86
approved these changes
Apr 10, 2026
Contributor
alexvy86
left a comment
There was a problem hiding this comment.
Seems good to me. I suggest also getting eyes from someone in tree.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
CraigMacomber
approved these changes
Apr 14, 2026
Contributor
CraigMacomber
left a comment
There was a problem hiding this comment.
Tree changes look good to me.
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.
Summary
@ungap/structured-clone(production dep) and@types/ungap__structured-clone(dev dep) fromapp-insights-logger,container-loader, andtreestructuredCloneis available in all supported environments (Node 20+ and ES2022 browsers), making this polyfill unnecessarytree, the internalclonere-export fromutils.tsis removed and the one test consumer is updated to usestructuredClonedirectly. This export was not part of the public API.structuredClonein@fluid-example/app-insights-logger's Jest config globals, since the jsdom test environment does not provide itBundle size impact
Measured via
@fluid-example/bundle-size-tests:All other bundles unchanged.
Test plan
pnpm buildandpnpm testpass inapp-insights-logger(21 tests)pnpm buildandpnpm testpass incontainer-loader(220 tests)pnpm buildandpnpm testpass intree(13,692 tests)pnpm testpasses in@fluid-example/app-insights-logger🤖 Generated with Claude Code