re-frame

https://github.com/Day8/re-frame/blob/master/docs/README.md https://github.com/Day8/re-frame/blob/master/docs/External-Resources.md
2020-07-29T05:34:04.104Z

I support the idea of namespaced events. I usually partition my app by views/usage with an additional general “components” folder for generic components. I think the challenge is to make a trade off between generic events and reasonability/locality of your logic. Moreover, you need the discipline to avoid calling events from other views, except the general one.

sandbags 2020-07-29T12:22:52.104900Z

@genekim might be interesting to render that out in a form that can be consumed by the Graphia application

1🤯
sandbags 2020-07-29T12:26:54.106100Z

Anyone using Klang? I am trying to work out why it's not loading. The ensure-klang-init function is complaining "Klang: Can't find React. Load by yourself beforehand." but I'm not even clear how that function is getting invoked. I can see preloads for 10x, re-frisk and so on but I've not added anything for Klang specifically.

sandbags 2020-07-29T12:30:20.106600Z

Ah, I think the Klang info! macro is invoking this the first time you use it.

sandbags 2020-07-29T12:30:46.106800Z

So, why can't it find React

sandbags 2020-07-29T12:33:01.107Z

It's testing for exists? js/React I wonder if that is an outdated method. Klang hasn't been updated in a few years. Is there something else doing the same thing baked into re-frame now?

2020-07-29T13:11:27.107200Z

@neo2551, sorry just reading over this. I've been wanting to do something similar for a while, how are you experiments coming?

2020-07-29T13:21:05.107800Z

It works, really well.

2020-07-29T13:22:43.109900Z

What I created several datascript/db inside my app-db, and the subscription works swiftly.

2020-07-29T13:25:24.112600Z

I usually try to have the datascript part in a single sub, and then pipe it into other subs for refinements, but I am really happy with the result. It alleviates me from deciding about a structure inside the app-db, at the cost of defining a schema for the ds and have a few transformation for transacting the entities.

2020-07-29T13:27:19.115400Z

You use d/db-with for performing transactions, and the rest is typical re-frame. In contrast to re-posh, the way you write the subscription feels more “natural” and you still get access to all the cool stuff from datascript such as access to the indices and all.

2020-07-29T13:33:04.115600Z

Do you have any example code other than what you've got prior to the thread?

2020-07-29T13:51:38.117100Z

Nope, but it summaries exactly what I did. Put a (d/empty-db) somewhere on your app-state and start to query and transact with it.

2020-07-29T13:51:58.117600Z

Immutability rules.

1
2020-07-29T14:09:53.117900Z

I'll give it a go, do you mind if I msg you here if I have an issue?

2020-07-29T14:29:09.118600Z

No problem :) Also message me if it works!

genekim 2020-07-29T16:07:48.119400Z

@neo2551 This sounds super interesting, as well — so to make sure I’m processing this all correctly: Option 1: @rberger suggests breaking up the events namespace, which I’m guessing are all required into the main events.cljs. This has the benefit of organizing the events, modularizing, information hiding, etc. Option2 : @neo2551 suggests going beyond just splitting up the events namespace, but actually creating separate dbs/events/subs, as per: http://day8.github.io/re-frame/App-Structure/ I think in my case, I’m going to try Option 1, because I’m not quite ready to distangle everything yet — but making separate piles of events is something I can manage. 🙂 thank you, all!

genekim 2020-07-29T16:11:22.120100Z

@mikethompson Thank you for re-frame — it is so fun to build things with it!

5🎉
2020-07-29T18:18:42.121400Z

The advantage of having fully qualified namespace is also to know where they are defined. But good luck :)

1🙏
rberger 2020-07-29T18:31:16.121700Z

@genekim We don’t require the events/*even.cljs in the top level / global events.cljs. We just require them as needed in the usually parallel views/*view.cljs files. Our current project did evolve from a global events.cljs to this model and I susepct we may eventually evolve to something like what @neo2551 suggests. But evolution is good. Learn as you go. One thing good about having them all in a global events though, is no worry about circular dependencies. It hasn’t bit us hard, but it has bit us a few times. Usually a bit of refactoring/rethinking fixes that.

1🙏