Fork me on GitHub

Curious what kind of subscription layers people have been using. I’m looking for something that gets me a bunch of “views” on data that’s in one atom and efficiently updates those views if the underlying data changes. I wrote once which kind of does this but there’s a few things I’d like to change about it so curious what other approaches are out there


I want to try the use-subscription hook, but the new one.


not quite, this is the old one I think


hah, I thank you, I have to realize I was very confused about the name of the thing I am talking about


It is related though, I think?


Using it in production and we quite like it so far.


It’s tied to React and doesn’t do too much. Haven’t had the need yet to change anything.


@ashnur you can see the mutable source in action too but I gave up on it until React releases a stable version.


I would like to see a more complex example with reseda


The demos are proof of concepts, do you have something in mind?


To phrase it differently, define “complex” 😜


@orestis thanks for sharing, I found that - at least in our codebase - get-in style subscriptions cause a lot of data transformations to happen in components. This makes them harder to use in REPLs and harder to test. So we’re looking for something that can create more complex derived data from multiple branches of the root atom


With resada it looks like that would only be possible with a selector function but then that function would be ran every time the root atom has sees any kind of changes.


Yes that’s true. Functions are in a way the lowest level in that they’re the most powerful flexible but hard to make guarantees.


It’s an interesting problem, how to cache results without running the code that produces the result? I guess intermediate steps might be a possibility, right? Cancel early. I’m curious about the domain you’re dealing with.


BTW reseda internationally deals with IWatchable so if your intermediate values implement the interface you can plug them into a reseda store to get the React updates for free.


orestis: my default example is a predictive autocomplete that can be reused in a form, with validation and possible completions both from client side and server side


it's the smallest thing that has all the gotchas that make these problems difficult