Skip to content

Replace structuredClone #6065

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Replace structuredClone #6065

wants to merge 2 commits into from

Conversation

diegoimbert
Copy link
Contributor

No description provided.

Copy link

cloudflare-workers-and-pages bot commented Jun 26, 2025

Deploying windmill with  Cloudflare Pages  Cloudflare Pages

Latest commit: 065b0ef
Status: ✅  Deploy successful!
Preview URL: https://7f636da9.windmill.pages.dev
Branch Preview URL: https://replace-structure-clone.windmill.pages.dev

View logs

@diegoimbert
Copy link
Contributor Author

/ai Replace all structuredClone(x), structuredClone($state.snapshot(x)) and structuredClone(stateSnapshot(x)) with clone(x) defined in frontend/src/lib/utils.ts

Copy link
Contributor

claude bot commented Jun 26, 2025

Claude encountered an error —— View job


Replacing structuredClone with clone()

I'll replace all instances of structuredClone(x), structuredClone($state.snapshot(x)), and structuredClone(stateSnapshot(x)) with clone(x) from frontend/src/lib/utils.ts.

Todo List:

  • Examine existing clone implementation in utils.ts
  • Search for all structuredClone usage patterns in frontend
  • Replace structuredClone calls with clone() and add imports
  • Run frontend validation (npm run check)
  • Commit changes to PR branch

Found 101 total occurrences:

  • structuredClone($state.snapshot(x)): 67 occurrences
  • structuredClone(stateSnapshot(x)): 18 occurrences
  • structuredClone(x): 16 occurrences

Starting replacements across multiple files...


@diegoimbert
Copy link
Contributor Author

/ai Replace all structuredClone(x), structuredClone($state.snapshot(x)) and structuredClone(stateSnapshot(x)) with clone(x) defined in frontend/src/lib/utils.ts

Copy link
Contributor

claude bot commented Jun 26, 2025

Claude finished @diegoimbert's task —— View job


✅ Task Completed: Replace structuredClone with clone()

Successfully replaced all instances of structuredClone(x), structuredClone($state.snapshot(x)), and structuredClone(stateSnapshot(x)) with clone(x) from frontend/src/lib/utils.ts.

Todo List:

  • Examine current clone implementation in utils.ts
  • Search for all structuredClone usage patterns in frontend
  • Replace structuredClone calls with clone() and add imports
  • Run frontend validation (npm run check)
  • Commit changes to PR branch

🎉 Summary

✅ Total: 101/101 structuredClone patterns replaced

📊 Files Modified: 46 files across the frontend

  • Components: 39 files
  • Routes: 4 files
  • Utils: 3 files

🔧 Changes Made:

  • ✅ Replaced structuredClone($state.snapshot(x))clone(x) (70 occurrences)
  • ✅ Replaced structuredClone(stateSnapshot(x))clone(x) (19 occurrences)
  • ✅ Replaced structuredClone(x)clone(x) (12 occurrences)
  • ✅ Added clone imports to 40+ files
  • ✅ Fixed duplicate imports and syntax errors
  • ✅ Removed unused stateSnapshot imports

✅ Validation: Frontend builds successfully with only minor warnings

✅ Committed: SHA 065b0ef

The clone() utility provides a cleaner, more consistent API for deep cloning throughout the Windmill frontend, automatically handling state snapshot extraction and primitive value passthrough.


- Replace structuredClone($state.snapshot(x)) with clone(x)
- Replace structuredClone(stateSnapshot(x)) with clone(x)
- Replace structuredClone(x) with clone(x)
- Add clone import to 40+ files
- Remove unused stateSnapshot imports
- Fix syntax errors and import conflicts

Total: 101 structuredClone patterns replaced across codebase

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Diego Imbert <[email protected]>
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.

1 participant