Fork me on GitHub
#clojurescript
<
2020-06-02
>
mruzekw01:06:06

Hi all, do y'all have any favorite libraries to make a graph db out of a CLJS map? I'm looking at use it with re-frame, and I like the idea of a set interface for querying and mutating the app-db. Something that defines the db structure for me with a set interface so I don't have to. (I've done this too many times with Redux apps, and it gets old!) I notice theres these, and I wondered if there are any favorites here: https://github.com/riverford/compound https://github.com/juxt/pull https://github.com/den1k/subgraph I didn't get any responses in the re-frame room, so thought I would ask here. Thanks.

p-himik06:06:28

I ended up heavily modifying subgraph to fit my needs. Up to the point when there's no original code left. :)

mruzekw17:06:50

Haha, thanks for sharing!

p-himik08:06:45

"And about 18 months later I found out about Datascript, which was very frustrating 'cause I would've just used that if I'd known about it" :D

p-himik08:06:15

But as I have mentioned plenty of times before - if you care about the performance, check it before going full-in with Datascript or anything like that. Prior to doing that, also think if you really need a graph database. In my projects, so far only the regular relational DBs were needed. And a couple of years ago when I tested Datascript performance vs Subgraph, Datascript was about 10x slower.

mruzekw17:06:55

@U2FRKM4TW Do you use any tools for a relation DB via CLJ maps?

p-himik17:06:45

As I said above - a heavily modified version of subgraph.

mruzekw17:06:49

That's open source? 🙂

p-himik17:06:01

Nope. And I doubt that it would be terribly useful since it's tailored for a particular project.

mruzekw18:06:24

Alright, just curious

raspasov01:06:09

@mruzekw it’s not quite a CLJS map, but what about https://github.com/tonsky/datascript ?

raspasov01:06:48

Using :db.type/ref you can achieve a graph (if I’m understanding correctly what you’re looking for)

mruzekw02:06:54

@raspasov That won't work for me since it doesn't fit well with the re-frame devtools (it expects a map)

mruzekw02:06:11

I'd use it if it were (and assuming the payload size was worth it too)

raspasov04:06:30

Perhaps there’s a way to convert the Datascript “db” to a map before passing it to re-frame devtools (this is just a speculation, I haven’t used re-frame and/or devtools)

mruzekw04:06:06

Yeah, don't know off the top of my head

awb9907:06:30

https://github.com/ryansolid/solid Does it make sense for clojurescript? Perhaps as a new rendering engine to Reagent?

phronmophobic07:06:57

does reagent currently support any other rendering engines besides react?

Chris McCormick08:06:23

there was talk of supporting Preact i am not sure if it works yet

phronmophobic17:06:46

I’m generally interested in adding alternative rendering engine support to some of the popular clojure UI libs. was hoping to find some examples. so far, it seems like most of the libs are strongly coupled with react and even more so with the DOM

Chris McCormick00:06:03

one that i know of which isn't coupled with React is Moria, a wrapper for Mithril: https://github.com/owengalenjones/moria

phronmophobic01:06:17

does that mean it’s coupled to mithril?

Eliraz09:06:09

hello, doe's anyone here has an experience with devcards? I've finally made devcards "work" but I get no components rendered on the screen, all I see is the devcards title and clojurescript logo.. how do I tell devcards to render those cards I have?

Eliraz09:06:58

I get no errors, just an empty page

gekkostate10:06:05

Hi everyone, any tips on optimizing the size of app.js and understanding the size of app.js? We have 4 external dependencies + react and the size is around 7 mb.

thheller10:06:40

which tool do you use? with shadow-cljs you can generate a build report that will tell you exactly how big everything is https://shadow-cljs.github.io/docs/UsersGuide.html#_build_report

gekkostate10:06:51

We use figwheel. Is there an equivalent?

thheller10:06:20

none that I'm aware of

gekkostate10:06:29

Shoot! Might have to do some manual digging to find out where the issues are.

p-himik12:06:03

If you don't want to or can't switch the project to shadow-cljs, you can maybe just build your project once with it. It will still require some work, but it may very well be worth it given that in my experience it's not a complicated procedure and manual digging is unpredictable.

gekkostate16:06:11

Ok, cool. I will try this. Thank you!

gekkostate16:06:38

Also, any tips / blog posts you recommend for switch from figwheel to shadow-cljs? Our setup for figwheel is quite standard and if shadow is better then we’d rather make the switch now.

thheller16:06:04

if you can share your build config I can tell you how the shadow-cljs config would look

👍 4
thheller16:06:50

only hurdle when switching typically involves figuring out what to do about cljsjs packages if you use any. if its just the standard re-frame setup with react then thats no issue but if you use custom packages it involves a bit of switching

kwladyka13:06:19

Do you use cljs with google cloud functions or in amazon? I am curious about your experience.

johanatan18:06:58

i use them in aws. much better than than jvm due to faster start time.

fbielejec19:06:49

sup Krzysztof 😉 I ran some experiments and wrote about them: https://www.blog.nodrama.io/clojurescript-serverless-graphql/ Serverless + shadow-cljs with named exports for the lambda functions. Since then we have a Lambda running a Pathom API over websocket in production (clients connect to an AWS gateway, make requests and reply is done via a POST to the gateway endpoint).

fbielejec19:06:36

Only custom component we had to add was a Redis instance to keep a mapping between the connected clients and authenticated users. If you go the vanilla route, and keep http request/response there's no need, and works pretty much as described in that simple example

kwladyka19:06:20

How are you doing @U44NW9H34? 🙂

kwladyka19:06:48

@U0E98NQG2 do you know how much faster?

johanatan19:06:04

Cold start time is tens of milliseconds for Node.js and several seconds for JVM.

johanatan19:06:39

GraalVM can be used to address the latter at the cost of reduced performance after warm up

didibus01:06:04

From my tests, compiled Graal is still faster then Node

johanatan01:06:18

I don’t doubt that

kwladyka13:06:10

and comparing this to Clojure (java) functions

ingesol13:06:29

I’m on clojurescript 1.10.764, still getting these in Chrome for many of my source maps:

DevTools failed to load SourceMap: Could not load content for webpack:///node_modules/react-datetime/dist/react-datetime.cjs.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
EDIT Also tested with cljs 1.10.773 Using bundle target, optimizations none

bhauman14:06:55

actually ignore that

sova-soars-the-sora18:06:00

Hi, I'm wondering if a generic "feedback for this page" clojurescript project exists. Ideally it would send the page location (url) that the person is viewing and their comments.

johanatan18:06:55

are custom formatters in chrome broken for everyone?