Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Slot-based routing #574

Merged
merged 9 commits into from
Feb 21, 2019
Merged

Slot-based routing #574

merged 9 commits into from
Feb 21, 2019

Conversation

Rich-Harris
Copy link
Member

ref #573. Mostly done, but a bunch of tests that aren't passing yet

@Rich-Harris Rich-Harris marked this pull request as ready for review February 20, 2019 23:39
@Rich-Harris
Copy link
Member Author

Been dogfooding this at work all day and I do prefer it — much less paranoid about state change false positives causing unwanted side-effects. That said, I kind of miss being able to pass props from a layout component to its children, so that /user/alice/friends and /user/alice/enemies can both share an object representing Alice.

It's definitely solvable with the context API, but not quite as elegant. One possible solution would be to have a way to expose all slot props:

-<svelte:component this={level1.component} segment={segments[1]} {...level1.props}>
+<svelte:component this={level1.component} segment={segments[1]} {...level1.props} let:*={props}>
  {#if level2}
-    <svelte:component this={level2.component} {...level2.props}/>
+    <svelte:component this={level2.component} {...props} {...level2.props}/>
  {/if}
</svelte:component>

Can cross that bridge another time though.

@Rich-Harris Rich-Harris merged commit e0de230 into master Feb 21, 2019
@Rich-Harris Rich-Harris deleted the slot-routing branch February 21, 2019 21:34
@Conduitry Conduitry mentioned this pull request Jul 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants