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

setContext in App.svelte not working, getContext returning undefined in children components #121

Open
nullbio opened this issue Jul 30, 2021 · 1 comment

Comments

@nullbio
Copy link

nullbio commented Jul 30, 2021

I have a setContext in my App.svelte where my <Router {routes} /> definition is, but when I call getContext in my Layout.svelte the value is undefined. It's also undefined if I call it from a route that gets called from within my Layout, but that's another layer of indirection and perhaps that's to be expected. The more pressing issue is that I can't use setContext within my App.svelte to pass values to my Layout file. Any advice on this?

To give a bit of context, I'm trying to pass around a store that holds an object to my layout, and also to my nested routes under my layout. I can't pass it into named params because params is of type Record<string, string>, but I need to pass along the whole object not just a string.

@flipkickmedia
Copy link

Can you provide a git repo with a basic example of what you are trying to achieve?

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

No branches or pull requests

2 participants