fix: remove checking buf until I can figure out how to not use buf.lock

This commit is contained in:
2025-05-12 12:19:03 -04:00
parent bfc1580218
commit 95ce559ff3
107 changed files with 630 additions and 658 deletions

View File

@ -1,31 +1,31 @@
import { getContext, hasContext, setContext } from 'svelte';
type Item = {
id: string;
name: string;
}
id: string;
name: string;
};
const key = 'form';
export function setFormContext(id: string, name: string) {
const item = getFormContext();
if (!item) {
const item: Item = $state({
id,
name,
});
setContext(key, item);
const item = getFormContext();
if (!item) {
const item: Item = $state({
id,
name
});
setContext(key, item);
return;
}
return;
}
item.id = id;
item.name = name;
item.id = id;
item.name = name;
}
export function getFormContext() {
if (!hasContext(key)) {
return null;
}
if (!hasContext(key)) {
return null;
}
return getContext(key) as Item;
}
return getContext(key) as Item;
}

View File

@ -21,7 +21,7 @@
<div bind:this={ref} class={cn('text-red text-sm', className)} {...restProps}>
{#if errors && Array.isArray(errors)}
{#each errors as error}
{#each errors as error (error)}
<label for={item?.id}>{error.message}</label>
{/each}
{:else if errors}

View File

@ -16,6 +16,6 @@
}
</script>
<div bind:this={ref} class={cn('flex flex-col gap-1')} {...restProps}>
<div bind:this={ref} class={cn('flex flex-col gap-1', className)} {...restProps}>
{@render children?.()}
</div>

View File

@ -2,8 +2,4 @@ import Field from './field.svelte';
import Errors from './errors.svelte';
import Label from './label.svelte';
export {
Field,
Errors,
Label
};
export { Field, Errors, Label };