Context Provider only getting default values - can't update
I'm trying to use a context provider in an astro app which is in a tauri app. While I'd normally wrap the <App /> component in the providers I don't have that option here so I'm wrapping individual components like this:
Then I feel like my context provider is pretty standard?
When I import createAdventurersName into another JSX component it will display "default value". When I import createSetAdventurersName into a JSX component is console.log AHHHHH
5 Replies
I'm not sure but I think you can't share context like this between islands
well that's terrible. I checked in their discord and they said it would work but it's not working so..... I guess I'll be using their nanostore
I guess you can but I don't think it's worth the effort. Apparently you "have to wrap the tree that needs context in its own component, and then use that in an Astro component"
I can't get that to work either but this mess works: 🙂
Store File:
File to Display Stuff:
I don't think so. the islands have isolated roots
so visually the hierarchy might make sense but the roots have no relation internally
Yeah I can think of how we could implement it but to my knowledge Astro adapter never implemented shared context between Islands in any of their renderers.
Biggest pain for it to work would be that hierarchically in the DOM parent components would need to hydrate before children. So you'd basically only ever use
client:load
for everything other than leaves.
I could implement context in Astro but their APIs could basically break it in a moment. In SolidStart Islands we don't have directives so it is always client:load
so I wired it up.Oh sorry I lost track of this post. Yeah I never got context to work with astro. It would be nice if their docs mentioned what worked/didn't work for a framework. There seems to be a lot of confusion about it.
Really looking forward to see where SolidStart goes it's already super good.