Brendan
Cast from `Type | undefined`
This is sort of just normal really. Typescript has no way to know that your
Show
component means that other calls to data()
will always have a value.
Since you know better, you can assert the value is non-null if you want to (with ! instead of ?):
8 replies
Reactivity lost if awaited function precedes?
Calling the getter after await should be fine as this is just an event handler (not an effect or memo).
What you describe suggests that the value of sessionSelected() is changing between when that click handler starts and when the async server call completes. Are you sure there isn't something else setting that signal in the meantime?
What you describe suggests that the value of sessionSelected() is changing between when that click handler starts and when the async server call completes. Are you sure there isn't something else setting that signal in the meantime?
33 replies
Routing in SolidJS "microfrontend"
In your case you may want to treat navigating to your sub-apps as an external link rather than a route (eg
<a href="/module1" target="_self">
). In that way it will refresh the whole page in the "new app" and there will still be only one Router (Module 1's). That does mean you can't have some overall layout surrounding all the modules though (at least not created by Solid).10 replies
Routing in SolidJS "microfrontend"
Although this... https://github.com/solidjs/solid-router/issues/342
10 replies
Route Intercepting
Yeah - but middleware only runs on requests as they reach the server. Not client-side which is where the navigation and rendering are happening (after initial load).
One option is to not show any links to pages the user is not allowed to see. If the user arrives on one of those pages it will likely from and external page which will hit the server - so middleware.
10 replies
Route Intercepting
After initial load, Solid apps usually route and render on the client. You mention
useBeforeLeave
in the #solid-start channel but that is really more intended for the "You have unsaved changes" scenario and is not a guaranteed thing (eg the current version does block back/forward although there is a PR for that).
Of course you 100 % need to enforce authorisation on each call to the server too (each route, api and server function) - see the following which also links to a good approach https://discord.com/channels/722131463138705510/910635844119982080/119041245793249689710 replies
Newest Router... Error about missing the wrapper Router component
To migrate, ensure the only childen under
Router
are Route
s. Move everything else you used to have that was inside Router
into the new root
property which gets passed the current matching route component as props.children
.
https://github.com/solidjs/solid-router?tab=readme-ov-file#configure-your-routes3 replies
"Outlet" is not exported by router anymore. How to use 0.10.x of router
Where you had
<Outlet/>
try {props.children}
instead.
https://github.com/solidjs/solid-router#outlet-routes-useroutes2 replies