MikeM42
createStore doesn't signal with a class as the store, but everything else works.
Many thanks for pointing me in the right direction @peerreynders . I may have to change my generators to do plain pjo interfaces, but for now I am going to try and work with classes using createMutable
7 replies
createStore doesn't signal with a class as the store, but everything else works.
Small amendment to the above it seems to work fine for 1 level class like above but doesn't seem to work with nested classes.
If you use the below classes:
class SomeThing {
'tryswitch': boolean;
constructor() {
this.tryswitch = false;
}
}
class TryMe {
'thing': SomeThing;
'trysw': boolean;
constructor() {
this.thing = new SomeThing();
this.trysw = false;
}
}
ANd you replace tryswitch with thing.tryswitch in the above it won't work, whereas with trysw it will.
Note that getters and setters of the store continue to work fine, its just that the signal doesn't seem to happen.7 replies
Solid Router within Router
How do you declare the Route to the component under which you declare the nested route though? You must declare it in some way that it will render any component unde /xyz/something through the component that holds the nested route, no?
22 replies
Solid Router within Router
I'd beg to differ, but I think that might lead us down a long winded mostly philosophical debate.
That being said I was able to do what you proposed. Had to externalize some properties etc. but it works, so thats cool.
Thanks for the assist!
22 replies
Solid Router within Router
I guess I could always create a master context, and then "attach" other contexts to that through a map or something, and the always useContext on the master context, and pull the sub-context from that, possibly even ad an remove the sub-context through onMount and onCleanup or something but would have been nicer if I could do it in the SolidJS framework.
22 replies
Solid Router within Router
Its more a segregation of concerns thing rather than anything else, I could put the context at the top level but then it feels like I am shoving everything at the top of the tree. Which could end up being very hard to maintain in the long run. The idea here was to have lets say a "sub-functionality" in the web-app that had its own context and its own routes. Makes things cleaner and easier to maintain as independent entities.
22 replies
Solid Router within Router
Hmm I wonder how I make this work, the problem is not so much the nested routes, I could declre the routes without the Router wrapper but I want those nested routes to be within a Context, and having Route wrapped in a context doesn't seem to work that well, it works for Router but not Route.
If I wrap the routes in a Context Provider what I get on the screen is:
[object Object][object Object]
Because its trying to render the routes which obviously dooesn't work that well.
Maybe I need to put some other logic in my Contexct provider and rather than just doing
<ContractContext.Provider value={value}>
{props.children}
</ContractContext.Provider>
I should maybe handle the props.children that are routes differently, but I don't kno whow 😩22 replies
createResource doesn't seem to be catching errors.
I was able to make it work by putting an ErrorBoundary around the form, I figured that probably that is when the error gets generated, hence probably where I should have an overal catch. I then had to wrapper the form in a component so that it could be both the fallback as well as the main component. This gives me mostly the behaviour I want. The one funky thing I had to do was to set the query twice in handleSubmit, so that the resource would reflect the change, which wasn't too bad.
10 replies
createResource doesn't seem to be catching errors.
I did not int he code I pasted but I tried to put an ErrorBoundary around the form afterwards and it didn't help. I have not tried using Suspense.
As I mentioned above also, the data.error does get set, and it would seem from my debug session that the code does get called as well, its just that the DOM doesn't change.
I've also tried using Switch / Match instead of the structure I have in the code above but the behavior is the same.
10 replies