hoplon

The :hoplon: ClojureScript Web Framework - http://hoplon.io/
2017-11-21T04:57:51.000067Z

@flyboarder i have grown to dislike form builder DSLs

2017-11-21T04:58:23.000116Z

forms are very complex things once you move past the basics like text fields and checkboxes and the DSLs i've used in the past all ran into diminishing returns quite quickly

2017-11-21T04:59:30.000125Z

i've been trying different things, currently moving away from the idea of "a form" and more towards "interactive DOM elements" that update a passed in cell

2017-11-21T05:02:30.000019Z

the interaction with my db sits with the cell, not the form

2017-11-21T05:04:23.000009Z

e.g.

2017-11-21T05:04:26.000042Z

(defn item-attribute-cell
 ([conn item attribute] (item-attribute-cell conn item attribute nil))
 ([conn item attribute init-v]
  (j/with-let [c (j/cell=
                  (attribute item)
                  (fn [n]
                   (assert (spec/valid? attribute n))
                   (when (not= n (attribute @item))
                    (j/dosync
                     (item.api/upsert-item!
                      conn
                      (merge @item {attribute n}))))))]
   ; upsert init-v if the attribute is not found
   (when (and init-v (not (attribute @item)))
    (reset! c init-v)))))

2017-11-21T05:05:05.000012Z

so... hanging things off spec and javelin lenses, basically

2017-11-21T05:11:21.000030Z

i could be way out of line here, but i feel the very idea of a monolithic form is tied to the idea of a form "action", which is tied to the idea of having a fat server doing all the work

flyboarder 2017-11-21T05:37:48.000024Z

@thedavidmeister interesting! My pattern comes from the idea that the state should not be tied to the form inputs, since those come from somewhere else

flyboarder 2017-11-21T05:39:28.000143Z

I think having a form state-machine should be something we can abstract from the elements

2017-11-21T06:14:31.000128Z

@flyboarder yeah, i agree that the "bigger" state shouldn't be tied to the form inputs

2017-11-21T06:15:00.000045Z

but being too strict about "zero state" elements restricts how dynamic/reusable/complex the elements can be

2017-11-21T06:16:13.000111Z

i think i'd like to hear more about what would go in the form state, that is beyond normal cell stuff

2017-11-21T06:16:25.000038Z

error handling is one thing to look at for sure

2017-11-21T06:18:05.000010Z

https://github.com/alexanderkiel/phrase is on my reading list because i want to tie things to spec more if i can, and someone mentioned that it could be used to convert machine predicates to human friendly warnings

flyboarder 2017-11-21T19:57:30.000118Z

Phrase is really interesting, there are many good ideas in there. Although I need to dive through the source more