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

Parent loader is not invalidated #460

Open
v-morlock opened this issue Aug 3, 2024 · 1 comment
Open

Parent loader is not invalidated #460

v-morlock opened this issue Aug 3, 2024 · 1 comment
Labels
bug Something isn't working question Further information is requested

Comments

@v-morlock
Copy link

Description
The form data of the parent layout is not invalidated when saving and redirecting back to the parent. My app is structured like this:

  • +layout.svelte
  • +layout.server.ts
  • +page.svelte
  • /subpage/+page.svelte
  • /subpage/+page.ts
  • /subpage/+page.server.ts

When submitting a superform on /subpage/+page.svelte, data is being saved to the database and a redirect back to /+page.svelte is triggered by

			return redirect(303, "<url>");

My superforms instance in /subpage/+page.svelte is configured like this:

	let superform = superForm(data.form, {
		validators: zodClient(baseArticleSchema),
		dataType: 'json',
		resetForm: false,
		invalidateAll: 'force',
		applyAction: true,
		onError(event: unknown) {
			console.error(event);
		},
	});

and additionally, i've enabled SUPERFORMS_LEGACY: true. When submitting the form, the navigation back to the main page works as expected, but the parent data from the layout-loader is only invalidated like every second time.

If applicable, a MRE
Let me know if you need a MRE, but maybe it's something obvious so just let me know please :)

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)

@v-morlock v-morlock added the bug Something isn't working label Aug 3, 2024
@ciscoheat
Copy link
Owner

A MRE would be useful for this!

@ciscoheat ciscoheat added the question Further information is requested label Aug 13, 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