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

Not working on SvelteKit 2 and Svelte 5 #38

Open
jramiroz98 opened this issue Jan 1, 2024 · 11 comments
Open

Not working on SvelteKit 2 and Svelte 5 #38

jramiroz98 opened this issue Jan 1, 2024 · 11 comments

Comments

@jramiroz98
Copy link

I get the following errors until the imports are removed

Error when evaluating SSR module

CompileError: Expected a valid CSS identifier

loc: {
    line: 773,
    column: 39,
    file: '/path/to/Toaster.svelte'
@huntabyte
Copy link
Collaborator

huntabyte commented Jan 6, 2024

We won't have full support for Svelte 5 until it is stable. Are you able to reproduce this with SvelteKit 2 and Svelte 4?

It sounds like a Svelte 5 issue considering its an error with compilation.

@huntabyte
Copy link
Collaborator

Update on this, there have been multiple reports of this with not only svelte-sonner, but also https://github.com/huntabyte/vaul-svelte, so it's definitely an issue with the Svelte 5 compiler.

@GimpMaster
Copy link

Just came here to say I got this issue with Svelte5 and Sveltekit 2

The toast shows up but just never goes away and console has all these messages...

image

@huntabyte
Copy link
Collaborator

Those are Svelte 5 issues which won't be officially supported until Svelte 5 is stable as it makes no sense to support something in alpha.

@GimpMaster
Copy link

That makes sense. Just wanted to report.

@pheuter
Copy link

pheuter commented Mar 1, 2024

I'm still getting a ERR_SVELTE_TOO_MANY_UPDATES error logged in the browser console on 5.0.0-next.69

@vexkiddy
Copy link

vexkiddy commented May 6, 2024

just incase others see this issue, but this was solved by updating svelte-5 to the latest version which is currently next.123 @pheuter @huntabyte. it should remove the 'too many updates' error :)

@wobsoriano
Copy link
Owner

thank you for the update @vexkiddy !

@hashproton
Copy link

hashproton commented Jun 20, 2024

Related to Svelte 5 and SvelteKit 2.0

How can I know when the Toaster component is mounted?

The <Toaster /> component is defined in +layout.ts.

I'm currently using the setTimeout workaround to ensure the toast is displayed correctly. Is there another approach to handle this, or is it a bug?

// +page.svelte
// This came from the server +page.server.ts
let { data } = $props();

let errors = $state(data.errors);

$effect(() => {
  if (errors) {
	  // setTimeout is used to prevent the toast from being displayed before the toast component is rendered
	  setTimeout(() => toast.error(errors[0].message, { duration: 5000 }), 100);
  }
});

@justinkwaugh
Copy link

I have run into the same issue with toasts pre-toaster mount not being displayed. It would be great if any calls to toast() prior to Toaster being mounted would be cached and then run onMount

@travisdmathis
Copy link

travisdmathis commented Aug 9, 2024

Working for me in Svelte 5(199)/Sveltekit 2 w/ shadcn-svelte

Untitled.11.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants