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

numberProxy, stringProxy don't restore with snapshot restore #435

Closed
1 task
ryanylee opened this issue May 26, 2024 · 2 comments
Closed
1 task

numberProxy, stringProxy don't restore with snapshot restore #435

ryanylee opened this issue May 26, 2024 · 2 comments
Labels
bug Something isn't working question Further information is requested

Comments

@ryanylee
Copy link

ryanylee commented May 26, 2024

  • Before posting an issue, read the FAQ and search the previous issues.

Description
With a form, I have a component like so:

<script context="module" lang="ts">
  import type { FormPathLeaves } from 'sveltekit-superforms';

  type T = Record<string, unknown>;
  type U = unknown;
</script>

<script generics="T extends Record<string, unknown>, U extends FormPathLeaves<T, number>" lang="ts">
  import { numberProxy, fieldProxy, type SuperForm } from 'sveltekit-superforms';

  export let form: SuperForm<T>;
  export let name: U;

  const proxy = numberProxy(form, name, { empty: 'zero', initiallyEmptyIfZero: true });
</script>

<input {name} {...$$restProps} type="number" bind:value={$proxy} />

However, when I restore from a snapshot, the field resolves to the default zod value rather than the cached value. fieldProxy works correctly and shows the right value

If applicable, a MRE
Use this template project to create a minimal reproducible example that you can link to here: https://sveltelab.dev/github.com/ciscoheat/superforms-examples/tree/zod (right click to open in a new tab)

@ryanylee ryanylee added the bug Something isn't working label May 26, 2024
@ciscoheat
Copy link
Owner

This seems to work fine for me, any difference for you? https://www.sveltelab.dev/tuc2qb4uru3to33

@ciscoheat ciscoheat added the question Further information is requested label Aug 12, 2024
@ciscoheat
Copy link
Owner

Closing, no activity

@ciscoheat ciscoheat closed this as not planned Won't fix, can't repro, duplicate, stale Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants