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

formDefaults undesired mutation by setting a svelte store #5

Open
christenbc opened this issue Nov 2, 2023 · 1 comment
Open

formDefaults undesired mutation by setting a svelte store #5

christenbc opened this issue Nov 2, 2023 · 1 comment

Comments

@christenbc
Copy link

bind:value={$formData.title}
bind:value={$formData.url}

For some reason, are mutating the original

const formDefaults = {
    icon: 'custom',
    title: '',
    url: 'https://'
};

this is an undesired behavior since

formData.set(formDefaults);

is setting the values to the previous once, hence the form is not being resetted.

What is going on?

@christenbc
Copy link
Author

I tested Object.freeze(formDefaults); is trying to be violated.

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

No branches or pull requests

1 participant