Fork me on GitHub
#re-frame
<
2018-03-07
>
caleb.macdonaldblack07:03:33

@achikin What’s wrong with an interceptor that would add to the :db (if it exists) fx in :after?

caleb.macdonaldblack07:03:28

I haven’t tested it so it might not work straight away.

achikin08:03:11

Yes, I know that technique. My initial challenge was to make it more reactive e.g. you should not stick a callback/interceptor in every place where you update the data.

achikin10:03:03

Yes, you're right. That's why I'm probably not going to use it in production code. Is there any way I can make it more like watcher without such tricks?

tobias11:03:22

@achikin wouldn’t it also be possible to keep a separate copy of the form input in the db and then compare those two in a subscription to see if the form input has changed?

achikin13:03:04

Yes, I'd probably take this path in the future. More generally speaking this leads to full-fledged undo functionality which is a bit overwhelming for me right now.

tobias13:03:32

Well you can undo all changes at once by replacing the form data with the original data. But not have a step by step undo.

tobias13:03:11

The subscription to enable the save button will be a simple (not= (:form db) (:original-form db))