Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Windows Tipps & SecurityNighthawk M7 Pro im Test: Flexibler, aber teurer 5G-Router(21.09.2026 um 10:30 Uhr)
Sichere ProgrammierungNeue Gmail-Funktion: So sparst du jetzt Zeit bei Einmalcodes(21.09.2026 um 10:00 Uhr)
Sichere ProgrammierungYour GIF exporter is fine — the container is the problem(21.09.2026 um 10:01 Uhr)
Sichere ProgrammierungCSS, Motion, or GSAP? I Choose by Who Owns the Animation(21.09.2026 um 10:12 Uhr)
Windows Tipps & SecurityNighthawk M7 Pro im Test: Flexibler, aber teurer 5G-Router(21.09.2026 um 10:30 Uhr)
Sichere ProgrammierungNeue Gmail-Funktion: So sparst du jetzt Zeit bei Einmalcodes(21.09.2026 um 10:00 Uhr)
Sichere ProgrammierungYour GIF exporter is fine — the container is the problem(21.09.2026 um 10:01 Uhr)
Sichere ProgrammierungCSS, Motion, or GSAP? I Choose by Who Owns the Animation(21.09.2026 um 10:12 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

SvelteKit Remote Functions Workaround Helpers

If you're like me, you've been waiting for Remote Functions in SvelteKit for a long... long time... and they are awesome! It will be extremely hard to ever go back. Even though they are still experimental, the time they save is…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

If you're like me, you've been waiting for Remote Functions in SvelteKit for a long... long time... and they are awesome!



It will be extremely hard to ever go back. Even though they are still experimental, the time they save is priceless.



However, not every feature is ready. So, I am posting a list of them, and their workarounds, and their status.






1. Submit Type



This is the least important, but needed. You may want to declare your enhance function outside the component template.



In form actions, you use types like this:




import type { SubmitFunction } from '@sveltejs/kit';

const onSubmit: SubmitFunction<MyFormType> = async ({ formElement }) => {
...

<form method="POST" action="/" use:enhance={onSubmit}>






There isn't a direct import for SubmitFunction, so you can derive it.




type SubmitRemoteFunction = Parameters<typeof myForm.enhance>[0];

const onSubmit: SubmitRemoteFunction = async ({ submit }) => {
try {
await submit();
} catch (error) {
console.error(error);
}
};

<form {...myForm.preflight(myFormSchema).enhance(onSubmit)}>






Issue Tracker






2. Form Data



Again, super small, but there is no formData passed. However, you can easily derive it.




const onSubmit: SubmitRemoteFunction = async ({ submit, form }) => {
const formData = new FormData(form);
// optional
const data = Object.fromEntries(formData);
// You shouldn't need this since everything is available
// in the form rune itself, but you never know...






Issue Tracker






3. Set Initial Data



Currently, the docs say to set the initial data by using fields.set. However, this is not dynamic, and will cause a state_referenced_locally error.



Remote Functions Warning



It also won't automatically set the values on updates. Here is a fix.




export function initForm(init: () => void) {

init();

let hydrated = false;

$effect(() => {

if (!hydrated) {
hydrated = true;
return;
}

init();
});
}






This will properly hydrate the form, while keeping it reactive. It will NOT run extraneously on hydration, but will be reactive.






Usage






initForm(() =>
updateChapterAccessForm.fields.set({
courseId: initialData.course_id,
chapterId: initialData.id,
isFree: !!initialData.is_free
})
);






Issue Tracker for this to be fixed.






4. Form Debug



This is not an issue, but a helper. We need a component to print the active form data for development similar to SuperForms (but actually uses runes instead of stores):




<script lang="ts" generics="T extends RemoteFormInput">
import type { RemoteFormFields, RemoteFormInput } from '@sveltejs/kit';
import type { RemoteForm } from '@sveltejs/kit';

const { form }: { form: RemoteForm<T, void> } = $props();

const fields = $derived(form.fields as RemoteFormFields<RemoteFormInput>);
</script>

<pre
class="mt-4 max-h-96 overflow-auto rounded-lg bg-gray-900 p-4 text-sm wrap-break-word whitespace-pre-wrap text-green-300">
{JSON.stringify(
{
values: fields.value(),
issues: fields.allIssues()
},
null,
2
)}
</pre>






SvelteKit Form Debugger



You can use it like so:




<FormDebug form={updateChapterForm} />






No Issue Tracker, as it is just a tool.






4. Touched



While there is no touched or pristine yet, I made a hook. However, this only works on the entire form, not individual fields. If anyone wants to build a hook, let me know, but hopefully this gets implemented sooner than later internally.




import type { RemoteForm, RemoteFormInput } from "@sveltejs/kit";

export const useTouched = <T extends void | RemoteFormInput, R = unknown>
(form: RemoteForm<T, R>) => {
const initialValue = JSON.stringify(form.fields.value());
return {
get touched() {
return JSON.stringify(form.fields.value()) !== initialValue;
}
}
};









Usage:






const touchForm = useTouched(myForm);
const isSubmitting = $derived(!!myForm.pending);
const isValid = $derived(!myForm.fields.allIssues() && touchForm.touched);

// touchForm.touched






Issue Tracker



And that is all I have for now, just wanted to put all these in one place.



Let me know your work arounds for now!



J

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten SvelteKit Remote Functions Workaround Helpers

Thematisch verwandte Begriffe: SvelteKit, Remote, Functions, Workaround · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-94030 | A security vulnerability has been detected in SerenityOS up to 3d83e4509…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick