inertia icon indicating copy to clipboard operation
inertia copied to clipboard

Resolve layout page slot-in issue using key block

Open dunhamjared opened this issue 6 months ago • 2 comments

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

  • I found a PR that includes this fix: https://github.com/inertiajs/inertia/pull/1705
  • This issue may be related: https://github.com/inertiajs/inertia/issues/1670

dunhamjared avatar Jan 03 '24 05:01 dunhamjared

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 avatar Feb 09 '24 13:02 dunhamjared

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!

dunhamjared avatar Mar 15 '24 14:03 dunhamjared

@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 avatar Apr 16 '24 12:04 reinink

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

reinink avatar Apr 16 '24 12:04 reinink

@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 #1614
  • Also I played a little with Svelte 5 beta release and there is a problem in inertia adapter: https://github.com/inertiajs/inertia/blob/ca7e7cbcd7f66bd37bc36741b5d3fcb9979db020/packages/svelte/src/createInertiaApp.js#L46-L54 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

punyflash avatar Apr 17 '24 01:04 punyflash

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

reinink avatar Apr 17 '24 11:04 reinink