leaving a note for <@U6SGRGAMU> and <@U5ZDXT94Z> a...
# prisma-whats-new
a
leaving a note for @gregor and @dankent and others: what do you guys think about creating a kind of universal schema that partitions between a local state composed of immutable.js records and a serialized state via graphql?
d
Interesting idea - how would you see it working? At the moment, I use a combination of apollo cache and direct redux state for local state. How would your approach be different?
a
I think it would be similar but with a level of abstraction up and some kind of organizing schema that designates whether a data (sub)tree is is local/server?
I’m kind of spitballing here, but the idea is to have a single source of truth for all state managed by the application
d
I think if I were going to go down that route, I would use the apollo store, using writeQuery and writeFragment to put local state in there with some metadata to mark it as local. I already do that to some extent to get optimistic UI updates for offline mutations
Apollo has too many convenient features to want to abandon it for some other source of truth
However, there are some things I like about segregating state that will only ever be local to the client and state that has come from the server or will at some point go to the server. I use apollo state for all server sourced or server bound state and separate redux reducers for things that are not intended to go to the server (at least in their current form)
Having these two kinds of state separated means it is obvious which is which
and also I have more freedom in how I structure the client-only state
a
yeah that makes sense I guess the thing is that I probably need to dig more into what I can do with apollo
mind if I contact you to talk some design strategies later on?
d
No worries - always happy to discuss stuff
It's well worth digging into the internals of how apollo works if you are using it. Lots of things made a lot more sense to me after I spend a few hours digging into how the store is structured and the various ways you can manipulate it