Nyantastic
Routing in SolidJS "microfrontend"
Thank you!
Yes I'm gonna give up the nested router idea. I guess there are several ways to handle this "seamlessly" (if that word even exists).
I'm going to try the solution you suggested on monday.
Thank you guys, for your time and your help! I would have spent so much time trying to figure this out. I really appreciate!
10 replies
Routing in SolidJS "microfrontend"
@Brendan , I tried your stackblitz example and changed a few things so that looks a bit more that what I currently have (I'm using lazy imports and navigate instead of <A> links). I don't know if it's good practice or not, but I was just curious about the differences of behaviour.
With these changes, you don't need to refresh to access the nested home page, but you can access it only once (wtf 😅 i mean when you go back to home or route2, if you click on Nested again you'll have to refresh ).
But then you can access the nested route2 by clicking on the link (which is now a button).
https://stackblitz.com/edit/solidjs-templates-34vudk?file=src%2Fnested%2Fnested-home.tsx
I don't know what to do next. Maybe if we could fix the "can access the nested home only once" thing, we could have something that works?
But I don't know how to fix it though
EDIT: My bad, I still have the same issue. I can navigate to nested/route2 by clicking on the link, but it matches the parent router's route when I type /base/nested/route2 in the browser. I'm sorry, I don't think this is really useful.
After this, I wonder if it's still a good idea to keep trying to implement it this way. What do you think?
10 replies
Routing in SolidJS "microfrontend"
Thank you so much for your time guys. I'm sorry I haven't tried yet, I needed to make sure I understood everything and burned out my brain 😅 I'm trying again today, I'll let you know!
Thanks again, I really appreciate!
10 replies
Routing in SolidJS microfrontend
@bigmistqke thanks for your answer! I'm not sure, I think it already does... I'm sorry, I made a new post where I drew the issue because I couldn't explain well here, I didn't find how to add the pictures to the original post 😰 if you want to check it out you're more than welcome!
3 replies
Trying to test a component containing a createResource
Thank you so much for your elaborate responses and for your time! Sorry I didn't see before. I understand better now, and yes I definitely should have paid attention to the resource being undefined.
I'm gonna try all this! Thanks again!
8 replies
Context store issue with array
Ok, I fixed the issue, if someday someone has the same problem:
I replaced the initialization:
setMyContext("myArray", [
{
...mockMyObject,
},
{
...mockMyObject,
},
]);
with:
setMyContext("myArray", [
JSON.parse(JSON.stringify(mockMyObject)),
JSON.parse(JSON.stringify(mockMyObject)),
]);
I guess there are better ways to clone, but that fixed the issue.
2 replies
Trying to update a value at index in a store array, updates all elements
Hi, hope you had a nice weekend!
Alright, this is the codesandbox I made to try to reproduce the bug:
https://codesandbox.io/p/sandbox/jovial-fast-s7z0xs?file=%2Fsrc%2FApp.tsx&selection=%5B%7B%22endColumn%22%3A63%2C%22endLineNumber%22%3A12%2C%22startColumn%22%3A63%2C%22startLineNumber%22%3A12%7D%5D
I apologize, some things must have been handled very poorly, but the bug is there.
I must have done something stupid to have this bug, but honestly I don't know where to look anymore. Maybe you'll spot the mistake!
In my example, I just have two buttons, each one uses the context. On click on one button, the function "setAttributeAtIndex" in the context is called, with the right index, and is supposed to update the count value. I wish it would update only the one the user clicked, but it updates both counts, at both indexes.
13 replies
Trying to update a value at index in a store array, updates all elements
I must have done something terribly wrong here.
What bothers me is also the fact that everything was working fine when the store was global. But I wanted to change that to a context, and now I'm having those issues 🫠
I'd be eternally grateful if someone has any idea!
13 replies
Trying to update a value at index in a store array, updates all elements
I also found something else, I don't know if it will help or make it worse:
In my unit tests, I also try to call the setObjectAtIndex function, like this:
context.setObjectAtIndex (mockObject, 0);
expect(context.myContext.myArray).toStrictEqual([
mockObject,
]);
=> Before this test, the array contained only one element, another mockObject, so it should be working.
=> The output of the test says, among other similar things:
- Symbol(solid-proxy): [Object],
+ Symbol(solid-proxy): [Circular],
But what would that mean? Any idea?
13 replies
createStore from fetched data ?
You're right. Right now I don't think I'll be having that problem, since the effect is depending on routeData, which isn't supposed to change, I guess ?
But I'll pay attention. I was just wondering if it was bad practice, since I'm pretty sure I read in the documentation that createEffect wasn't supposed to be used to update state, and that I should use createMemo instead. But maybe I understood that wrong 😳
7 replies
createStore from fetched data ?
Thank you for answering!
I've been trying to do that, but I'm not sure how to update it the right way. I think I'm not supposed to use createEffect (I've read somewhere that it wasn't supposed to be used to update states and values). Maybe with createMemo ? But how ?
7 replies