-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Nested routes info and problem reproduction #13
Comments
I'm pretty sure this is solved by #12 Navaid wasn't initially meant to run You can follow the discussion there about current concerns/roadblocks. Thanks for a very good repro! |
Well, you also have two handlers defined for every Once in the App and once in the PageTeam |
And how do you think I could do? How would you do it? This is one of my doubts. |
Personally I would move everything up to the App router. Since you already have & known all the components ahead of time, to me, it doesn't really make sense to sanction things off into units. As of now, they're all one App. For me, the separate (sub)router approach make sense for when you are dynamically loading some variable set of widgets into your application, each of which will have their own routing needs. Aka, unknown, unrelated, and/or physically separate things. For example, in my mind, I'm thinking of a WordPress editor that loads in different content blocks from different authors, each of which has their own series of config/states tied to URL segments. Since you're developing all of this together, I would define the router together. Personally. Now, after #12, you can keep this approach but remove |
Mmm, ok. So until then I can't remove it from App. Ok I'm not crazy! :) I will try to all in App now but what I don't understand is how to have the This is the problem. Am I wrong? |
I forked your app and have it so that all routing is under |
Oh dear. You removed In that page I insert other things, from GUI elements to other components. I need a mother page ( This is the problem. How to do this with all in the |
Oh, I was just blasting through it, sorry. I updated the link: https://codesandbox.io/s/flamboyant-worker-g1zlk Navaid is completely agnostic to what's happening & up until today/yesterday, there had been no concept of nesting or slots. That's up to the view layer, since it's there that view composition actually happens. In Svelte's world, this is what |
Ok. Great idea but now I need it to stay mounted during navigation. Or am I wrong? You can try by adding this in
|
Right, to me I didn't think it mattered, but I guess it was just because of the simple repro. This should do what you want then: https://codesandbox.io/s/reverent-tesla-c0kq0 Takes you closer to what you originally had, but just calls Edit: In the console, you'll see repeat |
Ok, thanks. I think this is a common need for web apps. I hope with #12 we can fix this once and for all by using the Do you see any performance problem using this approach? Are we missing some best practice? Can we avoid the repetition of "~> App is drawing :: Team" and so can we avoid to call that function again every time? |
This is the reason why I created a new routing library on top of Svelte. It's not so easy for most of developers to implement routing on it from scratch. I already have made it using Svelte v2, but I ask you to wait just a few days, since I'll release a new version on top of v3 and make a complete documentation. The v2 branch was using |
I agree Navaid is much better! |
I'm sorry @lukeed. There are people asking me about this:
Can you explain it to me deeply please? I know with import { afterUpdate } from 'svelte'
afterUpdate(() => {
console.log('ComponentPage just updated')
}) I can see everytime the message in console. |
Where did you add the |
You probably added it to This is what we had: let Route, params;
function draw(m, obj) {
console.log("~> App is drawing :: ", m.name);
params = obj || {};
Route = m;
} New routes assign new |
I apologize in advance if I'm wrong to open the issue and I shouldn't have done it here.
But I think it really concerns the basics of Navaid.
I'm also ready to open and update a wiki page for all newcomers like me.
THE PROBLEM:
I started from
svelte-demo
(https://github.com/lukeed/svelte-demo) and I'm trying to use nested routes for a list/detail view.REPRODUCTION: https://codesandbox.io/s/quizzical-dirac-2d0qy
To come to the problem you should:
Why?
Am I correctly using Navaid with nested routes?
Is this correct in
App.svelte
?The text was updated successfully, but these errors were encountered: