helix

https://github.com/Lokeh/helix
Lucy Wang 2020-10-15T01:12:38.034300Z

Sounds nice, I'm doing that too (requiring helix.core helix.dom) in almost every views.cljs (and helix.hooks for about 50% of these files). In comparison reagent is always imported once since everything is in reagent.core

lilactown 2020-10-15T05:43:01.036100Z

What use cases are you running into where you need helix.dom but not helix.core?

lilactown 2020-10-15T05:45:56.039100Z

Maybe more clearly, is there some reason you’re creating elements but not defining components using defnc?

lilactown 2020-10-15T05:48:35.041500Z

To your point Lucy, there was a deliberate attempt to be a bit more organized. It’s necessary to split anything that depends on react-dom from core to allow ease of use with things like react-native.

wilkerlucio 2020-10-15T13:25:52.042500Z

@lilactown hey, what you think about adding declare statements in helix.dom to allow static analisys to known about the variables defined by the macros? that's what Fulcro does: https://github.com/fulcrologic/fulcro/blob/develop/src/main/com/fulcrologic/fulcro/dom.cljs#L17-L30, I remember this being add as stubs on Cursive, but its not working on my end

jimmy 2020-10-15T13:50:20.050700Z

@lilactown It is less about not having to require the additional namespace and more about having to remember in some context to keep switching the namespace prefix (or not include one if you are referring, which I try to avoid). It is much easier to just do d/$, d/div, d/<> than to have to remember that the outer two are from helix.core instead. I have found my self making this mistake a lot. That said, there are cases where I am not defnc'ing in some namespace, because I am integrating helix into a big old hoplon code base. My defnc components are defined else where and then slowly integrated into the hoplon. In those cases, I generally, only need core for $, but occasionally mounting with some wrapper that doesn't really belong to the component is useful. I can of course use $, but part of my preference for the dom helpers is that they mirror what we are already doing in hoplon and it will be easier for me to teach people with them. In general, like I said, it is minor, but just seems convenient and doesn't cause any issues with keeping react-dom separate (which makes perfect sense to do).

jimmy 2020-10-15T13:51:41.050800Z

I will just add, that I started with just vanilla react and every time I ran into a little oddity, I thought about how I would fix it, then I went and looked at what helix did with it. Every time I found it was exactly what I would want to do, but just done more robustly. Super happy that helix exists.

ordnungswidrig 2020-10-15T14:02:48.054100Z

Hi, I really like the idea of reseda or any other library which offers a event/subscribe model for the application (like re-frame in reagent bases system). However it’s not clear to me how you would integrate this with 3rd party library which offer ther own state via hook. In my case this would be react-fire for firestore. This library basically offers useDocument hook which gives you access to a specific db document (including offline support, local caching etc). Would you copy the state to the global store managed by reseda? Just manage the state which is not in firebase and use the document state in the componend where needed?

orestis 2020-10-15T14:14:55.054800Z

Sounds like two stores to me @ordnungswidrig

ordnungswidrig 2020-10-15T14:15:48.055500Z

Yeah maybe yes. I wonder if there is prio art on keeping the necessary information in sync.

orestis 2020-10-15T14:17:09.056400Z

I think if they change differently, they belong to different stores. Both for semantics and for performance.

orestis 2020-10-15T14:17:40.057400Z

I don’t know react-fire but if there’s a lower level api that you could wrap in a “watchable” then reseda can wrap that.

ordnungswidrig 2020-10-16T07:54:44.069700Z

Cool, thanks for the info I need to have this go around my brain for a while

orestis 2020-10-15T14:18:44.058400Z

I tell a lie, to get initial values you also need to provide deref.

ordnungswidrig 2020-10-15T14:19:00.058600Z

yeah, I don’t think it would be feasable

ordnungswidrig 2020-10-15T14:20:26.059Z

Of cause you can use useEffect to monitor the return value of (useDocument "some-id") and then (dispath [:document-updated "some-id" the-new-value]) but I’ve got the feeling that will get you in trouble eventually

ordnungswidrig 2020-10-15T14:21:02.060Z

E.g. how to re-sync on a cold start etc.

orestis 2020-10-15T14:21:52.060500Z

Do you have a link to the docs of react fire?

ordnungswidrig 2020-10-15T14:27:16.060700Z

Sure, https://github.com/FirebaseExtended/reactfire

ordnungswidrig 2020-10-15T14:28:13.061Z

There’s also https://github.com/CSFrequency/react-firebase-hooks/tree/master/firestore but I didn’t look into the latter.

ordnungswidrig 2020-10-15T14:29:16.061200Z

What I found interesting was the support for Suspense. How does this play together with reseda?

ordnungswidrig 2020-10-15T14:30:59.061400Z

Regarding your initial question you could always use the firebase sdk which is based on promises. So my question is kind of more fundamental how to integrate 3rd-party hooks with reseda and whether that makes sense at all.

ordnungswidrig 2020-10-15T14:31:28.061600Z

I like the idea of having the effective state in a single, place. Just for being able to explore it. e.g.

orestis 2020-10-15T14:33:30.063100Z

Well, reseda store doesn’t really know anything about what’s inside. If you use a Suspending to wrap a promise, for reseda it’s still a value. It’s react that deals with the Suspense.

orestis 2020-10-15T14:34:32.064700Z

Looking at the react-fire example, you can have a reseda powered Suspending as a sibling (or child) of the Burrito element and react will wait for both to load before it renders.

orestis 2020-10-15T14:35:09.065600Z

Suspending wraps a promise which is single shot so I’m not sure how can you get streaming data though.

orestis 2020-10-15T14:35:53.066700Z

Like, real time - you’d need to watch a stream of changes and swap! Things into your atom as they change.

orestis 2020-10-15T14:36:03.067200Z

Gotta go now, catch you later.

lilactown 2020-10-15T15:04:39.068400Z

That sounds good, anything that helps people with editors that do static analysis is +1 for me

lilactown 2020-10-15T15:05:02.069200Z

Tempted to just write all the macros manually

wilkerlucio 2020-10-15T18:03:34.069400Z

https://github.com/lilactown/helix/pull/75