Fork me on GitHub
#hoplon
<
2016-02-04
>
thedavidmeister12:02:31

i feel like I’m getting better at hoplon in the front end after practicing a bit

thedavidmeister12:02:48

anyone have suggestions for a persistent backend for app state?

thedavidmeister12:02:02

that works well for hoplon with or without castra?

thedavidmeister12:02:11

i see datascript mentioned a lot

thedavidmeister12:02:24

is that something worth following up?

dm312:02:59

it's definitely interesting

dm312:02:38

it's handy if you want to allow arbitrary queries over the state of your app

dm312:02:09

or if the logic is expressible as datalog queries

thedavidmeister12:02:39

i guess what i’m trying to do, is have state that I can save and load somewhere

thedavidmeister12:02:03

and be able to do undo/redo too

dm312:02:09

you can make do with having the state as a map or the datascript database

dm312:02:12

doesn't make a difference

thedavidmeister12:02:41

my state will probably be either pretty nested

dm312:02:43

datascript only adds the indices over your data

thedavidmeister12:02:45

or split across a lot of cells

thedavidmeister12:02:18

whatever is best supported by available tools

dm312:02:11

if you have something with a lot of nesting and highly dynamic data - I'd look at datascript

thedavidmeister12:02:54

well, what i will have is a bunch of page elements that are essentially little forms/inputs

thedavidmeister12:02:07

that are repetetive

thedavidmeister12:02:25

and need to have all their values aggregated into something that can be computed globally

thedavidmeister12:02:37

so yeah, either nested

thedavidmeister12:02:59

or lots of little things with predictable structure that i can vacuum up

thedavidmeister12:02:34

if there’s a tool (like datascript) that naturally lends itself to the nested approach

thedavidmeister12:02:45

then i guess that helps me decide how to tackle this simple_smile

thedavidmeister12:02:09

is there a way to grab the whole datascript state and stick it somewhere on the backend?

alandipert12:02:17

@thedavidmeister: check out storage-atom, you can save an atom to a file in clj

alandipert12:02:45

Wildly inefficient and problematic but sometimes just what you need. Err: enduro is the project

thedavidmeister12:02:46

@alandipert: i got storage-atom working for localstorage

thedavidmeister13:02:31

i guess i’m worried about what happens with that approach if you have network issues or whatever

alandipert13:02:04

Firebase is another cool thing, at least for hobby projects

thedavidmeister13:02:24

i keep hearing about that

thedavidmeister13:02:27

haven’t used it

alandipert13:02:58

It's hosted db you can interact with via their JS api

alandipert13:02:18

So you don't need to host your own backend. They also handle auth

thedavidmeister13:02:32

how does storage atom deal with networking issues?

thedavidmeister13:02:50

i feel comfortable that localstorage won’t “go away” and mess up your state

thedavidmeister13:02:00

less so about remote stuff

alandipert13:02:42

The issues will be the same regardless of db choice

dm313:02:36

@alandipert: did you do any hoplon apps with datascript?

thedavidmeister13:02:52

oh I see you only swap! or reset! when someone clicks “save” or whatever

alandipert13:02:59

@dm3 only experiments

thedavidmeister13:02:17

i currently have my localstorage storage-atom just tracking state in real time

thedavidmeister13:02:23

i think i’m going to have to do some more reading

thedavidmeister13:02:04

enduro looks like it would struggle if i had 2 or more users

thedavidmeister13:02:36

if I understand what is being said under “resource management"

thedavidmeister13:02:20

or even just 2 or more states for a single user

thedavidmeister13:02:03

ultimate goal is that you could log in as a user, see a list of saved states and load it up

laforge4913:02:27

My intermediate-term goal is to have a very simple database that runs both in the browser and the server.

laforge4913:02:13

But right now I'm enhancing aatree/dewdrop--as a means of learning more about js.

laforge4913:02:24

--and I found some very nice code in javelin/core.cljs that does exactly what I need: deftype Ce;;

laforge4916:02:25

[ANN] Dewdrop (in aatree/aautil 0.0.4) now supports lens-view. Functions which work with lens-view are the standard @, reset! and swap!. The lens demo in hoplon/demos now employs lens-view. See https://github.com/hoplon/demos/blob/master/lens/src/hl/index.cljs.hl#L10-L16 Thanks to @micha for pointing out the inadequacies of the previous release. simple_smile

laforge4916:02:40

So, what is a lens view? It is the combination of a lens and an atom (or cell). Another example of a lens view is a Javelin formula cell. simple_smile