Fork me on GitHub
#re-frame
<
2019-04-26
>
twillis17:04:40

this might be a stupid question but what is the intended return values for reg-event-* for example if I return {} from a reg-event-db do I effectively wipe out the db or is the return value applied to what re-frame knows as the current state of the db?

ag19:04:45

hey friends, I’m struggling to make text-input to work right. I’m sure this is a common problem and I have solved this before, just right now I’m feeling utterly stupid. The problem is: I have a text-field that reads a value from db and renders it using :value key. in :on-change it dispatches and updates value in the db. So far so good. But here’s the problem: Whenever I try to type in the middle of the input - it immediately dispatches the event, updates the value in db, component re-renders and boom, cursor jumps to the end of the input. how do you generally deal with that?

ag19:04:26

I cannot use :default-value, because it works only “half-way”. Consider two instances of the same input component. If I change something in the first, I want changes to propagate to the second. That only works with :value key