Fork me on GitHub
#untangled
<
2016-09-08
>
gardnervickers17:09:38

Hey is there any reason untangled client does not allow you to set :shared and :shared-fn?

ethangracer17:09:24

@gardnervickers not particularly. we haven’t had a need to customize the reconciler options so we haven’t built it in

ethangracer17:09:30

what do you want them for?

gardnervickers17:09:39

@ethangracer We have a background process that has the potential to be long running and hold up other mutations, the plan was to stick it in a go-loop and merge-state when it finishes. I wasn’t sure the best place to store a reference to that.

ethangracer17:09:33

store a reference to what exactly?

ethangracer17:09:45

some indication that the process finished?

gardnervickers17:09:17

Something like {:process … :input-channel …}

gardnervickers17:09:36

So we can tear it down, and send data to it.

gardnervickers17:09:27

Oh hmm, I guess :shared wont give me a reconciler though...

ethangracer17:09:58

the other thing is that anything you put in shared can just as easily be replaced with links

gardnervickers17:09:08

That makes more sense

ethangracer17:09:18

if you have a long running process, is there a way not to put it in a mutation?

gardnervickers17:09:22

A set of mutations to setup/teardown the process and put my reference in the app state.

ethangracer17:09:35

really their only purpose is to modify app state, and send mutation requests to the server

ethangracer17:09:58

so if you have a background process on the client that isn’t constantly doing either of those things, it may be better not to run it inside of an om transaction

gardnervickers17:09:39

The background process is a pure function to update the app-db. As users enter text, it needs to be re-run with the most up-to-date data. We want to be able to cancel old runs and start re-processing with the new data.

ethangracer17:09:50

how is updating the app-db with new text a long process? I think I’m missing something

ethangracer17:09:20

if it’s easier to describe than type feel free to give me a slack call

gardnervickers17:09:41

Ok yea, so there’s an editor box where a user can type in some text. That’s fine and can be updated inside a regular mutation. However inside that mutation we want to signal to a background process that it should start running on the newly updated text, this long running background process provides a “compiled” version of the text in the editor box for a side window.

gardnervickers17:09:26

At a noisy coffee shop 😕 If I’m still doing a poor job describing this maybe we could chat later.

ethangracer18:09:31

I think what I don’t understand is why the background process is necessary. Seems like it’s a function that takes text from the editor box, and then does some kind of complex computation on the app state to generate new app state. Then when the computation is done, you want to use merge-state to push those changes back in

ethangracer18:09:12

So if that function is operating on the app state, which is theoretically pretty small, I’m not grocking why the task takes awhile

ethangracer18:09:23

maybe we should just chat when you’re not at the coffee shop

ethangracer18:09:14

sorry I don’t have a more immediate answer, we definitely haven’t encountered this kind of task before

gardnervickers18:09:52

Thanks for your help, I think my problems here are representative of a larger design issue.

ethangracer18:09:23

Yeah no worries, let me know if it ends up not being a design thing and we can talk about whether / how untangled could change to accomodate

tony.kay18:09:16

@gardnervickers In general long-running things have two approaches (if you need results in the UI): 1. Submit the mutation, and have it start it up (e.g. include a tempid), then periodically run a follow-up mutation (setTimer) that sends back the tempid and gets a remap on complete. 2. Something similar, but with web sockets for server push back of result

tony.kay18:09:58

That way your submission cannot block anything, and you manage the complexity on the server for the most part.

tony.kay23:09:00

Looks like Om alpha44 is out (2 days ago)

tony.kay23:09:00

I've released Untangled Client 0.5.5 to clojars.