helix

Stefan 2021-10-22T09:06:16.002800Z

Hi all, I’m doing a spike to determine what tech we want to use for our new SPA client. We are considering helix, so that’s what we’re using for our spike now. We like it a lot so far. A very important question that remains, on which I am hoping to get know your opinions, is what to use for global state management? We could use re-agent, but it appears that in that case most components have to be reagent components, which defeats the purpose of using Helix. We could use redux.js, maybe with a wrapper. What is your take on this?

alexdavis 2021-10-22T09:51:08.005500Z

I have been using react-query for all state management needs, with a couple of custom hooks that use the context for things like ui theme - no state management lib like redux/reframe needed. Works very well so far

alexdavis 2021-10-22T09:51:47.006100Z

But if you really want a reframe/clojury experience this looks pretty good https://github.com/orestis/reseda

Stefan 2021-10-22T10:07:09.006700Z

That certainly looks interesting, never heard of it before, thanks for that pointer @alex395

Stefan 2021-10-22T10:14:38.007400Z

@alex395 How well is reseda maintained? There are a few trivial pull requests open, so it gives the impression that it is not very well maintained?

Stefan 2021-10-22T10:15:27.008Z

@orestis That’s your library right? Do you consider it suitable for production use?

orestis 2021-10-22T10:41:21.008700Z

Hi @stefan.van.den.oord. We use it in production, so in some sense it's suitable for production use 🙂

orestis 2021-10-22T10:41:37.009100Z

Those trivial pull requests come from dependabot and are just noise

Stefan 2021-10-22T10:42:26.010600Z

Ah right I see. If we are going to use this, I would actually offer to co-maintain for this kind of stuff if you like.

orestis 2021-10-22T10:43:12.011500Z

It does help with a lot of aspects, especially the whole "assoc a pending promise wrapped in a "suspending" in a hook or a global store or wherever, then React will suspend until it resolves".

orestis 2021-10-22T10:43:42.012100Z

In the coming months we'll have to be working more on the global store aspect of stuff and some things like optimistic updates so I'm not sure if new primitives will appear.

orestis 2021-10-22T10:47:02.015Z

To clarify: reseda is two primitives that you can combine as needed. E.g. • First: a "store" that looks like redux if you squint, but for clojure data, backed by atoms • use that in a global var, and you have a global store. Put it in a React context, you have a scoped store. Stick it in a Ref and you have component-local state • Second: support for "Suspense for Data Fetching" where you use Suspense boundaries for async data.

orestis 2021-10-22T10:48:19.016900Z

The second primitive is completely orthogonal to the first, and it might see some more updates in the future.

Stefan 2021-10-22T10:48:58.017500Z

Yeah it seems like a useful library. I’ll include it in my spike today or Monday.

Stefan 2021-10-22T10:49:36.019Z

For me it is mostly about the global state side of things. But what you said about suspense also sounds good.

orestis 2021-10-22T10:49:42.019200Z

Let me know if you need any more guidance or if you have any feedback on the docs 🙂

Stefan 2021-10-22T10:50:05.019500Z

Will do, thanks!

lilactown 2021-10-22T17:15:08.020200Z

as part of your spike, it might be good to lay out exactly what kinds of state you want to be global

👍 1
lilactown 2021-10-22T17:15:22.020600Z

you might find that there are purpose built solutions for those already in the JS community

lilactown 2021-10-22T17:16:54.021200Z

i.e. for navigation, use react-router. for theming, use a CSS-in-JS lib

lilactown 2021-10-22T17:17:41.022200Z

for data fetching, you can use react-query. although, this is the one you probably want "native" CLJS support. I'm working on something for this slowly 🙂

2
lilactown 2021-10-22T17:20:11.022800Z

reseda seems like a great catch all rn, although i havent used it yet

lilactown 2021-10-22T17:30:40.023400Z

@orestis still trying to transfer ownership of hx to you. you'll need to delete your fork to do so 😄

orestis 2021-10-22T18:06:52.024400Z

Oh I need to merge a PR that points to it :) I will do so next week and bother you again

1