S
SolidJS13mo ago
Lalakis

Sort the data in createStore

This is my first solid-ts app. I got an array of objects and want to sort the by the number field which can be from 0 to an amount. I also want to sort by checkbox checked. I figure that out in javascript. In solid i run this changeTitles(sortedTitles); It seems not updating and breaking. The ui does not update. i tried createSignal, but the same (ui does not update). I tried reading more from the Docs.
10 Replies
Jasmin
Jasmin13mo ago
you probably mutate the array and its reference doesn't change try [...myArray.sort()] to create a new reference when you sort your array so you would do changeTiles([...sortedTiles])
Lalakis
LalakisOP13mo ago
I found the issue. I was using TransitionGroup to animate the sorting algorithm. Will this be possible? I have a checkbox that will be sorted last. The sorting and updating now works. But i wanted to add a TransitionGroup for an animation. Any help or docs to read?
thetarnav
thetarnav13mo ago
it should be possible to use sort with transition group
Lalakis
LalakisOP13mo ago
The <for each={} inside TransitionGroup was not updating, after removing TransitionGroup it started working
thetarnav
thetarnav13mo ago
hmm could you make a issue for it? it could be a bug
Lalakis
LalakisOP13mo ago
i am new to solid and my first project to solid. I will try tomorrow to make an example. If i manage to reproduce it on an example i will post it on github. (for everything i will inform here in the next two days)
thetarnav
thetarnav13mo ago
there is also shuffling in the example in the repo which is working fine, so maybe the move transition isn’t handled? https://github.com/solidjs-community/solid-transition-group/blob/5defdad7d3ae6c38120f63c8b343e86c22f899e4/dev/src/pages/group.tsx#L40 https://solid-transition-group.netlify.app/
GitHub
solid-transition-group/dev/src/pages/group.tsx at 5defdad7d3ae6c381...
SolidJS components for applying animations when children elements enter or leave the DOM. - solidjs-community/solid-transition-group
Lalakis
LalakisOP13mo ago
Thanks. you are right! It is not a bug. I had not installed on the right path the solid-transition-group. My vscode thinks i am using react and gives me wrong hints. Last question: any vscode extensions you recomment? I had two package.json
thetarnav
thetarnav13mo ago
vscode extensions? just the default typescript one will work fine you just need to add solid-js as jsx import source in tsconfig
Lalakis
LalakisOP13mo ago
I am happy today (i made the transition work). I started solid this week. Sorry for the confusion! i need to go now
Want results from more Discord servers?
Add your server