-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Updating to [email protected] (or later) throws some errors. #10188
Comments
Yeah it needs to be fixed in Astro: sveltejs/svelte#10581 (comment) |
@mwc would you be willing to submit a PR that fixes this? Should work not just in the |
Hello @mwc. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with |
@matthewp 👌👌👌 I'll give it a try. |
@mwc Sorry for not mentioning, but I was already looking into it in the past hour 😅 If you want to try, I can let you do so though. I haven't got far yet. |
@bluwy import { hydrate, unmount } from 'svelte'; // --> here
import { add_snippet_symbol } from 'svelte/internal';
// Allow a slot to be rendered as a snippet (dev validation only)
const tagSlotAsSnippet = import.meta.env.DEV ? add_snippet_symbol : (s) => s;
export default (element) => {
return async (Component, props, slotted) => {
if (!element.hasAttribute('ssr')) return;
let children = undefined;
let $$slots = undefined;
for (const [key, value] of Object.entries(slotted)) {
if (key === 'default') {
children = createSlotDefinition(key, value);
} else {
$$slots ??= {};
$$slots[key] = createSlotDefinition(key, value);
}
}
// --> here
const component = hydrate(Component, {
target: element,
props: {
...props,
children,
$$slots,
},
});
// --> and here
element.addEventListener('astro:unmount', () => unmount(component), { once: true });
};
}; ... then it work. I'm afraid it will take me longer than you, so it's better if you fix it. |
Yeah, we also need to use
And finally we need bump the peer dep too to next.56:
And also test it manually. We don't have automated tests for Svelte 5 yet but that's fine. |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
1、If the svelte version is later than 5.0.0-next.55, the following error will be thrown, the result of rendering is not as expected as the next-55.:
2、Most likely because the 5.0.0-next.56 updated hydrate.
3. Not sure if this issue should be fixed by astro or by svelte.
What's the expected result?
like [email protected]
Link to Minimal Reproducible Example
none
Participation
The text was updated successfully, but these errors were encountered: