Fork me on GitHub
#re-frame
<
2017-09-10
>
mikethompson02:09:44

@henrik you might be interested in the Track feature of https://kishanov.github.io/re-frame-datatable/

Casey13:09:14

Is it possible to use existing react component libraries with re-frame? In particular I'm interested in using the react semantic ui component lib: https://react.semantic-ui.com/

stvnmllr214:09:50

Just added a feedback form that captures the entire appdb state. And then I load it into the app from an admin page. Can see exactly what the user was seeing. Pretty cool stuff re-frame/reagent!

reefersleep15:09:15

@stvnmllr2 I have had this use case in mind for reagent from the very beginning, but never got around to implementing it. Do you have intent of librarifying your solution?

reefersleep15:09:54

@ramblurr maybe you should check out soda-ash or sodium? I only know they’re related to react.semantic-ui, haven’t used them or anything. https://github.com/gadfly361/soda-ash https://github.com/deg/sodium

Casey16:09:49

@reefersleep ah, very nice, thanks for the links.

Casey16:09:05

I want to build an offline first app that keeps all state and data locally, with syncing to a server occasionally. Normally I'd use PouchDB for this, but in this brave new clojurescript world I'm entering, I'm not sure if that's possible

Casey16:09:36

looking around the ecosystem I see datascript, datsync, but they don't seem applicable in the this case

lxsameer16:09:14

Hi folks, is there any solution to avoid running all the subscriptions at any update on app-db ?

reefersleep16:09:20

@ramblurr does “syncing to a server” basically mean “overwriting the saved state on the server with the newest local state”? Or is it more complex than that (for example involving several offline/occassionally-online users?)

Casey16:09:32

there needs to be some kind of conflict resolution, not just "newest wins"

Casey16:09:47

the data model of this application actually fits quite well to the pouch/couchdb data model (one user per "store", little to no collaboration on shared data among users), which is why i was thinking along those lines to begin with

Casey16:09:02

I saw an interesting talk (https://www.youtube.com/watch?v=DdkwNTgtIJ0) about re-frame, and the speaker says he used pouchdb, so it must be possible.

stvnmllr217:09:35

@reefersleep No, it was pretty trivial and tied to specific events and a db in my case , so not sure a library is needed.

reefersleep17:09:45

@ramblurr talk to Martin Clausen then? he’s @mac here 🙂 EDIT: (btw mac, only outing you because you seem like a nice guy who wouldn’t mind! sorry!)

reefersleep17:09:50

(I think… met him a couple of times at #copenhagen-clojurians meetups)

reefersleep17:09:39

@stvnmllr2 it does seem like something that requires trivial programming, but involving implementation-specific technologies

reefersleep17:09:11

like how and when to contact the server, and how to communicate the saved state to the admin panel

reefersleep17:09:27

or even if there is a server involved 😄

Casey17:09:45

Ah cool mac is here 🙂 I sent him a tweet, but maybe he'll see this!

mac19:09:43

@ramblurr It is very possible to use PouchDB. I don't have any public code out there using PouchDB with cljs , but happy to help with any questions.

mac19:09:11

@reefersleep Happy to be outed 🙂

reefersleep19:09:53

@mac thought you might be 😉

mac19:09:01

@ramblurr PouchDB is available on http://cljsjs.github.io/ so you can start by adding to your :dependencies.

reefersleep20:09:37

@ramblurr I think your use case sounds like it could be done by hand, though? Depending on requirements you haven’t mentioned. looks into pouchdb

reefersleep20:09:23

ship off your frontend state to the backend periodically (such as when the user opens the app and is actually online, or do asynchronous, periodic checks, like every 5th minute or whatever, to see if the user is online) and then have your conflict resolution in the backend, with whatever data store you desire (sounds like simpler is better in your case)

reefersleep20:09:20

it’s a problem I’d like to try my hand at 🙂 at a toy level, any way. If there’s a library that takes care of complications I haven’t even thought of, I’d surely go for that!

reefersleep20:09:45

@lxsameer I’m in doubt about what you’re asking? Aren’t only the subscriptions whose data has changed run?

lxsameer20:09:18

@reefersleep As far as i know, and tried all the subs run on each change on app-db, and I want to confirm it by asking it in here

reefersleep21:09:18

@lxsameer just tested it in a re-frame project of mine, it did seem to be the case that a particular sub was run on each db change

reefersleep21:09:26

is this a problem in your case?

mikethompson22:09:15

@lxsameer all Layer 2 subscriptions will rerun on any change to app-db. That's why we keep them trivial. All real computation is put into Layer 3 subscriptions.

lxsameer22:09:13

@mikethompson hmm so as far as i understand, my observation was correct. all the subscriptions will run by each app-db change

mikethompson22:09:50

All Layer 2 subscriptions will run on any app-db change

mikethompson22:09:09

Layer 3 subscriptions will only run if their inputs are different from last time

lxsameer22:09:30

I'm a bit lost in here

mikethompson22:09:17

To say that another way: 1. subscriptions will run when the value of their inputs have changed 2. Because the input for Layer 2 subscriptions is app-db they will run on every app-db change 3. Because the inputs for Layer 3 subscriptions are other subscriptions they will only run when the derived value (output) of those subscriptions change

mikethompson22:09:27

Have a read through the link I supplied

lxsameer22:09:12

ow so layer 3 refers to nested keys for subscriptions

mikethompson22:09:54

That's a limited view, but yes you could see it that way

mikethompson22:09:05

and use it that way

lxsameer22:09:10

@mikethompson I'm using re-frame with a websocket connection and I'm sending data to client constantly

lxsameer22:09:14

the problem is I have lots of 2 layer subscriptions and on each message all of them execute and slow down the app

mikethompson22:09:08

So you'll either have to batch updates or design appropriately layered subscriptions