Fork me on GitHub
#fulcro
<
2017-11-09
>
cjmurphy00:11:58

From my Java days IIRC Error is the type at the top of the hierarchy of Java exceptions. I'll try keeping the existing form but using :pre with Error rather than Exception.

cjmurphy00:11:40

Hmm - that doesn't help, still whatever is being passed in is something other than an Error even: java.lang.AssertionError: Assert failed: (instance? Error ex)

cjmurphy00:11:39

So (throw ex) gives a reasonable result (shows the underlying Datomic problem). But also having serialize-exception do nothing (return nil) ensures that the cause of the problem is not lost.

cjmurphy00:11:47

I've tried to find the type of ex, but code from within serialize-exception does not seem to be amenable to println, log/warn or log/error.

wilkerlucio12:11:09

@tony.kay question, when you pulled the code from om to fulcro 2.0, you did it from master, right?

tony.kay15:11:28

@currentoor I have not. I’ve tried a few libs, had success with about 20% of them.

tony.kay15:11:43

@roklenarcic Fixed. On 1.1.0-SNAPSHOT on clojars

tony.kay15:11:20

@cjmurphy Throwable is at the top, actually. I changed the code on develop and also pushed this with 1.1.0-SNAPSHOT to clojars. Let me know if that is better.

tony.kay16:11:40

So, currently in Fulcro 1.0, because Om Next is underneath, one could augment the read local parser and technically trigger remote reads. This is not an advertised “feature”, but probably works (I’ve not tested it, but don’t see why it wouldn’t). This is possible useful for those porting from Om Next, but in 2.0 carrying around this legacy way of doing remote reads complicates things. Anyone see a good reason why I should continue supporting this local parser-based remote-read behavior?

wilkerlucio16:11:11

nope, I think we can just discard it, IMO it's a very complex and hard to grasp method, specially if we can do cleanup without it

tony.kay16:11:27

that’s my feeling as well

wilkerlucio16:11:31

cool, I was asking about the version because some of my PR's that got merged there have things that I'm missing

tony.kay16:11:16

glad to pull them in if I missed them

tony.kay16:11:38

there are probably a number of pending PRs that would be useful, though there is a lot of simplification going on that may fix bugs

tony.kay16:11:51

(and possibly create new ones 😕 )

mitchelkuijpers16:11:28

@currentoor If you want to use npm-deps try shadow-cljs that basically fixes all issues with using external libraries

tony.kay16:11:06

@mitchelkuijpers That’s nice to know. I was wondering about that.

mitchelkuijpers16:11:52

I am fixing some stuf for it but it works very smart, it doe simple optimizations for your npm deps and also fixes a lot of issues with externs

mitchelkuijpers16:11:21

And theller the maintainer is really helpfull

currentoor16:11:46

@mitchelkuijpers thanks I’ll give it a shot. It should result in a reduced build size right? Vs using cljsjs?

mitchelkuijpers16:11:48

And it still does advanced compliation but only on your cljs code and not the external npm-deps

mitchelkuijpers16:11:06

Yeah if you only import certain namespaces

wilkerlucio19:11:33

trying to find the docs for tx-fallback, you guys remember where is it?

wilkerlucio19:11:26

is there a way to have a post mutation after a regular mutation? (sounds very funky when it's out loud :P)

tony.kay21:11:37

fallbacks are defined in data-fetch and mutations namespaces.

wilkerlucio16:11:45

my problem is that I have a series of mutations, but I need the second one to run only if the first one succeed

wilkerlucio16:11:58

currently it sends both at same time, giving no room to stop in the middle

tony.kay18:11:58

Why can’t the server decide? E.g. why can’t you send both?

wilkerlucio20:11:09

I guess it can be done by calling a mutation on a fulcro load, I ended up not needing it, but I feel way more confortable knowing the option is available if I need to

tony.kay05:11:41

I hear you on the comfort…it bugs me as well…but I just have yet to see a case that really needed it. As soon as you admit logic to the tx chain, you’re in for a lot more complexity at the UI layer. You’re essentially asking for a tx with logic: (transact! this [(f) (when ok? (g))]), but you’re going to implement it through exposing async at the UI layer.

tony.kay05:11:05

Seems like there are these cases: 1. remote mutation followed by local (conditional on first) 2. remote mutation followed by remote (conditional on first) (1) is trivial with mutation-merge (2) would require you to at least run a transact! from mutation merge (which is only OK if you defer it via setTimeout), or use a follow-on remote read with a post-mutation.

tony.kay05:11:32

I’m still trying to get my head around what pattern should be used. I’m having trouble finding objective criteria on this.

tony.kay05:11:28

I guess, technically, running (js/setTimeout (fn [] (transact! reconciler ...)) 0) is perfectly fine. It won’t “nest” the transaction since you’re deferring it to the next “idle time”. You can save your app off to an atom, so you can get at it at any time. So, from that perspective perhaps I just need to document that you may run transact! anywhere you want, as long as it is wrapped in this trick when you’re currently inside of another transaction’s processing.

tony.kay05:11:23

I don’t think that sucks. Perhaps I add something to the API like inner-transact! or trigger! that is just that

tony.kay05:11:38

that still moves us away from callbacks as the mechanism. Tracing isn’t so bad, because it is in the context of a sequence (which you’ll also see in the history)….and each tx is just data that appears in the history as well.

tony.kay05:11:24

There are very limited places they would occur, and they’d still be directly navigable (assuming you put any mutation merge handler near the mutation it was merging)

tony.kay05:11:49

jump into a mutation: you can see the inner trigger! calls, which you can nav to from there.

tony.kay05:11:16

still gets them out of the UI layer, where we’re trying to preserve the illusion of no async

tony.kay05:11:48

main down-side: they are not an immediately apparent part of the UI tx

tony.kay05:11:10

But the other option of trying to embed logic in the tx somehow just sounds abhorrent

tony.kay21:11:00

I have no idea what you mean about post mutations on regular ones…that’s called functional composition within the original mutation

cjmurphy22:11:06

@tony.kay Yes {:pre [(instance? Throwable ex)]} fixed the issue (I just changed that on my local version). Makes sense that the Datomic 'exception' I was having implemented Throwable.

tony.kay23:11:02

If anyone is interested in (better) upcoming support for return values from mutations, please read/comment on https://github.com/fulcrologic/fulcro/issues/55

tony.kay23:11:31

@cjmurphy Great! Thanks for letting me know