Skip to content
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

[Question] Is it possible to replace fastCloneDeep JSON.stringify(JSON.parse with structuredClone() ? #1016

Closed
kievsash opened this issue Oct 16, 2023 · 2 comments
Assignees
Labels

Comments

@kievsash
Copy link

Hi
REASON to ask:
I am implementing custom angular file-select component and want File object to be accessible as formfield value on formSubmit. But when I do valueChanges.emit({file: someFileObjWithBlob}) inside custom element then on submit event I get empty object (btw customEvent transfer File obj correctly)

After small ivestigation I suspect that maybe it is because in submit event handler we sometimes do copy with fastCloneDeep Util function which is just JSON.parse(JSON.stringify(obj))
So maybe it make sense to replace it with structuredClone?
structuredClone does File structure copy correctly.

What do you think?
image
image

@travist
Copy link
Member

travist commented Dec 5, 2024

Yes, please submit a pull request with this change and we would be happy to merge it. Another alternative is that we are releasing a new "slim" angular module called "@formio/angular/embed". This may be another good option since we will be officially releasing that soon.

@kievsash
Copy link
Author

kievsash commented Dec 6, 2024

Hi @travist
Thank you for answering
here is a pr: formio/formio.js#5942

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants