Brendan
Brendan
SSolidJS
Created by Daniel Sousa @TutoDS on 7/17/2024 in #support
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 ?):
<ProjectHeroSection
title={data()!.title}a
headline={data()!.headline}
thumbnail={data()!.thumbnail}
/>
<ProjectHeroSection
title={data()!.title}a
headline={data()!.headline}
thumbnail={data()!.thumbnail}
/>
8 replies
SSolidJS
Created by d34dbug on 1/18/2024 in #support
Reactivity lost if awaited function precedes?
The safe option is probably capturing the value at the start of the handler - like the second code sample above is doing. That way you know you are using the same value all the way through.
33 replies
SSolidJS
Created by d34dbug on 1/18/2024 in #support
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?
33 replies
SSolidJS
Created by Nyantastic on 1/9/2024 in #support
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
SSolidJS
Created by Nyantastic on 1/9/2024 in #support
Routing in SolidJS "microfrontend"
I think that for now, nested <Router> is never going to work.
The only option with the new router is to lift all the routes to be direct children of the top-level <Router>.
10 replies
SSolidJS
Created by Nyantastic on 1/9/2024 in #support
Routing in SolidJS "microfrontend"
10 replies
SSolidJS
Created by Rajesh Joshi on 1/3/2024 in #support
Router with hash integration or hash Router in SolidJS
...instead of <Router>
3 replies
SSolidJS
Created by Rajesh Joshi on 1/3/2024 in #support
Router with hash integration or hash Router in SolidJS
3 replies
SSolidJS
Created by Christian on 12/30/2023 in #support
Route Intercepting
Client-side for cosmetic purposes but enforced on any relevant server endpoints (as client can't be trusted to actually be from your code).
10 replies
SSolidJS
Created by Christian on 12/30/2023 in #support
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
SSolidJS
Created by Christian on 12/30/2023 in #support
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/1190412457932496897
10 replies
SSolidJS
Created by danboyle8637 on 12/29/2023 in #support
Newest Router... Error about missing the wrapper Router component
const App = props => (
<>
<h1>My Site with lots of pages</h1>
{props.children}
</>
)

render(() => (
<Router root={App}>
<Route path="/users" component={Users} />
<Route path="/" component={Home} />
</Router>
), document.getElementById("app"));
const App = props => (
<>
<h1>My Site with lots of pages</h1>
{props.children}
</>
)

render(() => (
<Router root={App}>
<Route path="/users" component={Users} />
<Route path="/" component={Home} />
</Router>
), document.getElementById("app"));
3 replies
SSolidJS
Created by danboyle8637 on 12/29/2023 in #support
Newest Router... Error about missing the wrapper Router component
To migrate, ensure the only childen under Router are Routes. 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-routes
3 replies
SSolidJS
Created by hannus on 12/17/2023 in #support
does Effect have a number limit?
No practical limit - beyond the browser running out of memory (probably thousands??).
2 replies
SSolidJS
Created by kdabir on 12/10/2023 in #support
"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-useroutes
2 replies