glassy
glassy
SSolidJS
Created by halu on 5/30/2024 in #support
SOLVED: Trigger Side Effects on a Callbacks Dependency Updates
so in any case, I guess having the in-memory store mirror how it's stored in the database would be a good idea
181 replies
SSolidJS
Created by halu on 5/30/2024 in #support
SOLVED: Trigger Side Effects on a Callbacks Dependency Updates
but could be other ways. hierarchical storage in relational database is always something I have to read up on the different ways to do it everytime
181 replies
SSolidJS
Created by halu on 5/30/2024 in #support
SOLVED: Trigger Side Effects on a Callbacks Dependency Updates
probably the database just has a 'parent' column
181 replies
SSolidJS
Created by halu on 5/30/2024 in #support
SOLVED: Trigger Side Effects on a Callbacks Dependency Updates
and that is the downside of not storing it as a straight tree. however, in the end if it comes from a database, then the database stores it in the same way
181 replies
SSolidJS
Created by halu on 5/30/2024 in #support
SOLVED: Trigger Side Effects on a Callbacks Dependency Updates
even with saving just one, could still have inconsistent data (eg. a non existing child or a non existing parent).
181 replies
SSolidJS
Created by halu on 5/30/2024 in #support
SOLVED: Trigger Side Effects on a Callbacks Dependency Updates
so at least the persisted data doesn't become broken
181 replies
SSolidJS
Created by halu on 5/30/2024 in #support
SOLVED: Trigger Side Effects on a Callbacks Dependency Updates
then with both parent and children have to be careful they don't lose sync. maybe only serialize one and generate the other on load
181 replies
SSolidJS
Created by halu on 5/30/2024 in #support
SOLVED: Trigger Side Effects on a Callbacks Dependency Updates
I kind of skipped the discussion so sorry if I missed something, was just looking at that and thinking about it.
181 replies
SSolidJS
Created by halu on 5/30/2024 in #support
SOLVED: Trigger Side Effects on a Callbacks Dependency Updates
talking about this one
181 replies
SSolidJS
Created by halu on 5/30/2024 in #support
SOLVED: Trigger Side Effects on a Callbacks Dependency Updates
without link to parent then if I want to delete item 'c' I'd have to scan every item to look for its parent
181 replies
SSolidJS
Created by halu on 5/30/2024 in #support
SOLVED: Trigger Side Effects on a Callbacks Dependency Updates
maybe each node needs to point both to children and parent
181 replies
SSolidJS
Created by halu on 5/30/2024 in #support
SOLVED: Trigger Side Effects on a Callbacks Dependency Updates
very nice solution. but deleting an item is hard?
181 replies
SSolidJS
Created by halu on 5/30/2024 in #support
SOLVED: Trigger Side Effects on a Callbacks Dependency Updates
So it's true, createMutable might be the most straightforward way to implement trees. I might still try that produce approach above though when I get to it (lol)
181 replies
SSolidJS
Created by halu on 5/30/2024 in #support
SOLVED: Trigger Side Effects on a Callbacks Dependency Updates
I did ask about stores within stores: https://discord.com/channels/722131463138705510/722131463889223772/1246075106707636305 And it seems it is supported. So I'm thinking maybe that could be used for trees. But again, that might still be kind of more complicated.
181 replies
SSolidJS
Created by halu on 5/30/2024 in #support
SOLVED: Trigger Side Effects on a Callbacks Dependency Updates
lol exactly, just saw that
181 replies
SSolidJS
Created by halu on 5/30/2024 in #support
SOLVED: Trigger Side Effects on a Callbacks Dependency Updates
Yes, tradeoffs.
181 replies
SSolidJS
Created by halu on 5/30/2024 in #support
SOLVED: Trigger Side Effects on a Callbacks Dependency Updates
Each recursive component would have to keep record of it's path so you can start at right node when you want to do an operation on it.
181 replies
SSolidJS
Created by halu on 5/30/2024 in #support
SOLVED: Trigger Side Effects on a Callbacks Dependency Updates
I still think produce might work
setStore(produce(store => {
callRecursiveFunctionToDoSomethingOn(store)
}))
setStore(produce(store => {
callRecursiveFunctionToDoSomethingOn(store)
}))
And if starting at a deep point then
setStore(produce(store => {
const node = store[get][to][the][deep][path]
callRecursiveFunctionToDoSomethingOn(node)
}))
setStore(produce(store => {
const node = store[get][to][the][deep][path]
callRecursiveFunctionToDoSomethingOn(node)
}))
181 replies
SSolidJS
Created by halu on 5/30/2024 in #support
SOLVED: Trigger Side Effects on a Callbacks Dependency Updates
For trees, rendering isn't an issue cause the component root can just take the store root. But doing modifications to it is the hard part I think. Gonna have to think about it cause trees are something I will need to implement in my app eventually too.
181 replies
SSolidJS
Created by halu on 5/30/2024 in #support
SOLVED: Trigger Side Effects on a Callbacks Dependency Updates
I haven't tried that. OK let me think, you mean (I think I read somewhere) a Chat Message that can have children Chat Messages?
181 replies