keechma

Keechma stack. Mention @U050986L9 or @U2J1PHYNM if you have any questions
urbank 2017-08-22T11:19:44.000036Z

@mihaelkonjevic Do you absolutely prefer a system where the subscriptions decide what needs rerendering as opposed to the commands declaring somehow what they are changing? If you know what mean

mihaelkonjevic 2017-08-22T11:20:31.000200Z

hm, I’m not sure I understand

urbank 2017-08-22T11:22:57.000133Z

Well, reactions return some data, right? They rerun if that data has changed. This happens every render. I'm thinking what it would look like if instead of subscriptions, commands would decide what needs rerendering. Commands declare what they change.

mihaelkonjevic 2017-08-22T11:24:29.000072Z

so you can manually re-render some component?

urbank 2017-08-22T11:26:37.000102Z

Something like that. More so that you can say what the command wants to rerender when you know it won't change something else. Hm... yeah, I'm not saying this well

urbank 2017-08-22T11:26:49.000195Z

I'm thinking that something like this might be pluggable

urbank 2017-08-22T11:26:55.000255Z

so

mihaelkonjevic 2017-08-22T11:28:34.000009Z

what is the problem you’re trying to solve?

urbank 2017-08-22T11:32:02.000089Z

Components could declare when they send a command which subscriptions the command affects so that other subscriptions would just take the cached value. Mostly trying to reduce the number of unnecessary rerenders when I absolutely know only one of them had to happen. I wrote this example in the reagent channel

urbank 2017-08-22T11:32:39.000046Z

Hm... so with reactions. If I have a list of components which can either be in view or edit mode. they all deref a subscription to find out whether they should be edited. when I just had view they all just received an id and rerendered when the data associated with the id changed but now they all depend on knowing which id is being edited so when the id that is being edited changes, they all update I suppose I'm asking if there's a way to make this more fine grained to more explicitly decide when to rerender based on current and previous value of reaction (edited) so only rerender if id of row is the same as the edit id

mihaelkonjevic 2017-08-22T11:33:29.000112Z

I think you can use reactions inside the reactions

mihaelkonjevic 2017-08-22T11:33:44.000004Z

so you don’t deref the whole app-db if you don’t want to

urbank 2017-08-22T11:34:39.000004Z

hm... right. Yeah, this might be it. I'll try something

mihaelkonjevic 2017-08-22T11:37:25.000244Z

do you have a performance problem somewhere? If you can reproduce it in some example, I could try to see if I can help 🙂

urbank 2017-08-22T11:41:59.000138Z

Yeah, it's not really extreme. It takes a bit longer for a row to change into an edit row than I would like. Thanks for the offer, you're very helpful, I'll try to reduce the example 🙂 Theres 85 rows. They're semantic ui table rows using soda-ash

urbank 2017-08-22T11:42:36.000084Z

Granted, this computer is getting a bit bogged down and it's not the production version of react

mihaelkonjevic 2017-08-22T11:49:29.000262Z

I’m not familiar with the semantic ui API, but it could be possible that it’s doing re-rendering when it’s not needed. I’ve had similar issues with material ui and reagent. It’s hard to get it right because when you cross the border between reagent and normal react, things can get weird

urbank 2017-08-22T11:53:06.000037Z

Might be. Perhaps I should try the same table with just classNames for the css.

urbank 2017-08-22T11:53:57.000221Z

I mean, it's not dreadfully slow. 200ms on my relatively bogged down computer and the develop version of react . But I'm being cautious.

urbank 2017-08-22T11:54:58.000055Z

When the row is actually being edited it's fine too, because the edit id doesn't change. Just the part when a row changes into an edit row

urbank 2017-08-22T11:55:07.000358Z

causes a reflow as well, I think

urbank 2017-08-22T11:58:04.000048Z

Actually a couple of different refactors to the subscriptions would all solve it, I think.

urbank 2017-08-22T12:28:14.000117Z

Em... so @reefersleep solved the problem for me in the reagent channel. I just need to return a boolean from the subscription instead of the edited id.

mihaelkonjevic 2017-08-22T12:48:24.000083Z

awesome!