fuma 0.4.10 → 0.4.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@
7
7
  ReturnData extends Record<string, unknown> = FormDataInput<Shape>,
8
8
  Data extends FormDataInput<Shape> = FormDataInput<Shape>
9
9
  "
10
- >import { createEventDispatcher, onMount, tick } from "svelte";
10
+ >import { createEventDispatcher, onMount } from "svelte";
11
11
  import { fade } from "svelte/transition";
12
12
  import { page } from "$app/stores";
13
13
  import { contextContainer } from "../context.js";
@@ -64,13 +64,8 @@ const { enhance, setError } = useForm({
64
64
  });
65
65
  const { handleInput, isDirty } = useHandleInput({ model, setError });
66
66
  onMount(lookupValueFromParams);
67
- isDirty.subscribe(async (_isDirty) => {
68
- await tick();
69
- if (isDirty)
70
- dataInput = data;
71
- else
72
- data = dataInput;
73
- });
67
+ $:
68
+ $isDirty ? dataInput = data : data = dataInput;
74
69
  function lookupValueFromParams() {
75
70
  fields.flat().forEach(({ key }) => {
76
71
  if (data[key])
@@ -23,7 +23,6 @@ export function useHandleInput({ model, setError }) {
23
23
  handleInput: ({ target }) => {
24
24
  if (!target)
25
25
  return;
26
- isDirty.set(true);
27
26
  if (!model)
28
27
  return;
29
28
  const { name, type, value, valueAsNumber, valueAsDate, checked } = target;
@@ -40,6 +39,7 @@ export function useHandleInput({ model, setError }) {
40
39
  return;
41
40
  if (!model[name])
42
41
  return;
42
+ isDirty.set(true);
43
43
  const res = model[name].safeParse(v);
44
44
  if (res.success) {
45
45
  setErrorDebounced.clear();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fuma",
3
- "version": "0.4.10",
3
+ "version": "0.4.11",
4
4
  "description": "My fullstack material build with sveltekit, daisyui, zod, prisma, lucia",
5
5
  "author": {
6
6
  "name": "Jonas Voisard",