Brendonovich
Brendonovich
Explore posts from servers
SSolidJS
Created by jack on 12/15/2024 in #support
dealing with data shared between pages
yeah fair, those are a bit more holistic
38 replies
SSolidJS
Created by jack on 12/15/2024 in #support
dealing with data shared between pages
i'd say that makes sense, they're router apis afer all, not start apis
38 replies
SSolidJS
Created by jack on 12/15/2024 in #support
dealing with data shared between pages
no the data is fetched by the route, but since props are read lazily the resource read happens in the component underneath its own suspense
38 replies
SSolidJS
Created by jack on 12/15/2024 in #support
dealing with data shared between pages
my favourite thing i've ever done in that regard is when i put suspense boundaries inside a card component so that no matter how i used it there was skeleton ui
38 replies
SSolidJS
Created by jack on 12/15/2024 in #support
dealing with data shared between pages
personally i prefer the example i gave since it lets you be more fine grained with your suspense boundaries
38 replies
SSolidJS
Created by jack on 12/15/2024 in #support
dealing with data shared between pages
yeah that's also an option
38 replies
SSolidJS
Created by jack on 12/15/2024 in #support
dealing with data shared between pages
you could do something nicer with proxies
38 replies
SSolidJS
Created by jack on 12/15/2024 in #support
dealing with data shared between pages
getData would use the list data or suspend
38 replies
SSolidJS
Created by jack on 12/15/2024 in #support
dealing with data shared between pages
we did something similar to that with tanstack query and some other things, a basic way you could do it is something like
const list = createQuery(listQuery);
const detail = createQuery(detailQuery);

const index = .. // get this somehow;

const getData = (cb) => cb(list.data[index]) ?? cb(detail.data)

const name = () => getData(v => v?.name)
const list = createQuery(listQuery);
const detail = createQuery(detailQuery);

const index = .. // get this somehow;

const getData = (cb) => cb(list.data[index]) ?? cb(detail.data)

const name = () => getData(v => v?.name)
38 replies
SSolidJS
Created by jack on 12/15/2024 in #support
dealing with data shared between pages
and you'd have to do a lookup in the array by index or id
38 replies
SSolidJS
Created by jack on 12/15/2024 in #support
dealing with data shared between pages
you could use the list data in your details view if you want, it just gets messy when your list data is only a part of the full details data
38 replies
SSolidJS
Created by jack on 12/15/2024 in #support
dealing with data shared between pages
like going from list -> details view?
38 replies
SSolidJS
Created by jack on 12/15/2024 in #support
dealing with data shared between pages
wdym?
38 replies
SSolidJS
Created by jack on 12/15/2024 in #support
dealing with data shared between pages
personally i'd put all async state in ts query and local state in stores
38 replies
SSolidJS
Created by jack on 12/15/2024 in #support
dealing with data shared between pages
yeah query is only so useful
38 replies
SSolidJS
Created by jack on 12/15/2024 in #support
dealing with data shared between pages
i'd reach for tanstack query to do this, have a ["groups"] query and a ["group", number] query that you keep in sync manually
38 replies