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

Fix Svelte 4 slot rendering issues #1763

Merged
merged 2 commits into from
Apr 16, 2024
Merged

Conversation

dunhamjared
Copy link
Contributor

@dunhamjared dunhamjared commented Jan 3, 2024

Fix #1733
Fix #1621

Overview

When routing between layouts, Svelte (v4.1.0 and above) will not slot in the pages correctly.

This PR implements additional logic with a key block to guarantee accurate page rendering while maintaining the persistent layouts feature.

Notes

@punyflash punyflash mentioned this pull request Jan 30, 2024
@dunhamjared
Copy link
Contributor Author

Hi @claudiodekker -- please let me know if there is anything I should do for this PR to be reviewed. It will be really nice to have this fix in the official repo!

Thanks again for all of your work!

@dunhamjared
Copy link
Contributor Author

Hi @reinink -- I may have pinged the wrong person.

Please let me know if you have any questions about this PR. :)
And thank you for your time and consideration!

@reinink reinink changed the title Resolve layout page slot-in issue using key block Fix Svelte 4 slot rendering issues Apr 16, 2024
@reinink reinink merged commit 645d710 into inertiajs:master Apr 16, 2024
4 checks passed
@reinink
Copy link
Member

reinink commented Apr 16, 2024

@dunhamjared Thanks so much for this fix! My apologies on the long delay on this one, I don't work with Svelte myself day-to-day so updating this adapter is a little more tricky for me. In the past I've had a couple Svelte developers helping me maintain this adapter. If you're interested in helping more on this project to keep this particular adapter updated that would be amazing.

@punyflash Sorry that we pushed you to create a fork of this adapter while waiting for us. If you'd be interested in helping more officially with maintaining the Svelte adapter I'd be grateful for that — really need a couple people on our team who know the internals of Svelte well.

@reinink
Copy link
Member

reinink commented Apr 16, 2024

This fix has been released as part of v1.0.16 👍

@punyflash
Copy link
Contributor

@reinink, that's ok, open source should not be an obligation for anybody, I believe making the fork and doing something yourself is more fair than pushing others doing that for you. I'm not familiar with svelte internals that much, just following where the project moving in general. I can create some PRs with the stuff I came up with in my fork:

  • Reconfiguring build using SvelteKit: allows compiling Svelte TS components.
  • Used this TS implementation with a few fixes Svelte TypeScript support #1614
  • Also I played a little with Svelte 5 beta release and there is a problem in inertia adapter:
    if (isServer) {
    const { html, head } = SSR.render({ id, initialPage })
    return {
    body: html,
    head: [head],
    }
    }
    }

    Right now, there is no setup function call for svelte's SSR build — SSR component just rendered as is. In Svelte 5 this syntax will no longer be valid. For this to work properly for both old and new syntax, I reworked app initialization a little in next tag. This however will require to update a documentation for SSR initialization a little bit.

Please tell me what you would like to see in your adapter, and I'll gladly work on PR when I'm free

@reinink
Copy link
Member

reinink commented Apr 17, 2024

@punyflash yeah that would be amazing! I'd love to get Svelte TypeScript support added (#1614), going to add a comment there 👍

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

Successfully merging this pull request may close these issues.

Routing between default layout and persistent layout doesn't slot in the page Issues with Svelte 4
3 participants