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

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?


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


It works, really well.


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


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.


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.


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


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.


Immutability rules.


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


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: 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!


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

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.