Fork me on GitHub
#om
<
2015-11-01
>
jdubie00:11:09

was surprised i had to override merge-tree to get this simple app to work https://github.com/jdubie/om-next-starter/blob/master/src/om_starter/core.cljs#L47. @dnolen why did you choose this as the default implementation? https://github.com/omcljs/om/blob/master/src/main/om/next.cljs#L1232

dnolen00:11:09

@jdubie no particular reason other than it’s simple. it shouldn’t be at all surprising that you should have to override it.

jdubie00:11:01

ok awesome

dnolen00:11:30

@jdubie: once you starting thinking about property deletion etc. there’s no good choice but the one that works for your app.

dnolen00:11:56

might revisit, but would rather get a lot more feedback about how people implement :merge-tree before deciding anything.

dnolen00:11:06

there’s also repercussions for error handling - another area which needs more thought

jdubie00:11:51

i’m coming from a world were i make an RPC and then have logic based on status code (show error / on to next state). how should i think about handling remote mutation errors? om next is great for maintaining consistency by reading modified keys afterward. however, not sure cleanest way to get a message on why it failed back from server

dnolen00:11:05

it’s also the case that if you do a lot of optimistic updating, :merge-tree might not be something you even care about

dnolen00:11:45

@jdubie: error handling is something that will likely be a user concern

dnolen00:11:55

and Om Next will just get out of the way and provide tools to solve it however you want

dnolen00:11:05

there’s no such thing as a good default error handling story

dnolen00:11:22

same as there’s no such thing as a good default :merge-tree handling story.

jdubie00:11:56

cool. makes sense

dnolen00:11:36

some apps may want to fail entire responses, others may want something more fine grained

dnolen00:11:55

picking something means ending interesting use cases

dnolen00:11:17

or requiring horrible work arounds

dnolen00:11:24

I'm tired of that type of thing.

jannis00:11:53

I can't wait to wire up my kanban demo with a real backend, I'm eager to try the remote story

dnolen00:11:48

@jdubie: hopefully things are flexible enough that people can provide typical forms of error handling error patterns as a kind of middle ware (or standard reconciler customization)

dnolen00:11:07

people should think about the merge strategy & error handling like templating.

dnolen00:11:25

leave these to user innovation for a while … maybe even indefinitely

jannis02:11:25

Yay. It may not be pretty, but I'm working on a generic (horizontal) Om Next list component that allows DND reordering, can handle arbitrary sequential input data and doesn't restrict what elements are used for the reorderable children (well, for the most part): https://github.com/Jannis/om-next-kanban-demo/blob/master/src/kanban/components/sortable_list.cljs Usage here: https://github.com/Jannis/om-next-kanban-demo/blob/master/src/kanban/components/board_dialog.cljs#L44 Example: http://jannis.github.io/om-next-kanban-demo/ -> Boards -> Development -> Edit -> Reorder lanes via DND

rui.yang02:11:45

@jannis looking forward to your remote story:+1:

kurtlazarus14:11:28

@jannis: Thanks for the kanban demo. Great for a starter.

adamfrey19:11:38

Anyone know what cb stands for here in David Nolen’s om-next-demo? https://github.com/swannodette/om-next-demo/blob/master/todomvc/src/cljs/todomvc/util.cljs#L18 I know it’s the function that you call to merge new server state.

teslanick19:11:34

An example of its usage is on line 26 -- a callback that receives EDN.

adamfrey19:11:03

ah, thanks!

steveb8n22:11:01

@jdubie an possible enhancement for om-next-starter, here’s how I am logging exceptions https://gist.github.com/stevebuik/f97901dda45926313e1c

steveb8n22:11:04

I’m not claiming elegance but it’s useful for folks starting to see how exceptions are surfaced

steveb8n22:11:15

I still haven’t worked out how to do the same with a client parser. that’s much less obvious, exceptions seem to be removed at some layer that I haven’t found yet

jdubie23:11:14

very cool @steveb8n. smart to do that at the middleware level.