untangled

NEW CHANNEL: #fulcro
gardnervickers 2016-09-08T17:34:38.000003Z

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

2016-09-08T17:39:24.000004Z

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

2016-09-08T17:39:30.000005Z

what do you want them for?

gardnervickers 2016-09-08T17:41:39.000006Z

@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.

2016-09-08T17:43:33.000007Z

store a reference to what exactly?

2016-09-08T17:43:45.000008Z

some indication that the process finished?

gardnervickers 2016-09-08T17:44:17.000009Z

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

gardnervickers 2016-09-08T17:44:36.000010Z

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

2016-09-08T17:45:21.000011Z

Hm

gardnervickers 2016-09-08T17:45:27.000012Z

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

2016-09-08T17:45:42.000013Z

nope

2016-09-08T17:45:58.000015Z

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

gardnervickers 2016-09-08T17:46:03.000016Z

True

gardnervickers 2016-09-08T17:46:08.000017Z

That makes more sense

2016-09-08T17:46:18.000018Z

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

gardnervickers 2016-09-08T17:46:22.000019Z

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

2016-09-08T17:46:35.000020Z

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

2016-09-08T17:46:58.000021Z

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

gardnervickers 2016-09-08T17:52:39.000024Z

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.

2016-09-08T17:53:50.000025Z

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

2016-09-08T17:54:20.000026Z

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

gardnervickers 2016-09-08T17:55:41.000027Z

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.

gardnervickers 2016-09-08T17:56:26.000028Z

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

2016-09-08T18:00:31.000029Z

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

2016-09-08T18:01:12.000030Z

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

2016-09-08T18:01:23.000031Z

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

2016-09-08T18:02:14.000033Z

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

gardnervickers 2016-09-08T18:03:52.000034Z

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

2016-09-08T18:18:23.000035Z

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.kay 2016-09-08T18:21:16.000036Z

@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.kay 2016-09-08T18:21:58.000037Z

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

tony.kay 2016-09-08T23:31:00.000039Z

Looks like Om alpha44 is out (2 days ago)

tony.kay 2016-09-08T23:40:00.000040Z

I've released Untangled Client 0.5.5 to clojars.

👍 5
🤘 2