Fork me on GitHub
#reagent
<
2015-07-11
>
zoldar00:07:43

@coyotespike: This may not necessarily be the source of the problem but have you tried assuring that password is derefed only once? As in (let [password @password] ... the body ... ). I assume that password is a reaction - and every deref of a reaction causes a rerender - I got bitten by it once in the beginning when working with rendering a data in the table

mikethompson00:07:23

@coyotespike: That sort of code works beautifully for us, all the time. So you are doing something (probably simple) wrongly but absolutely don't resort to using domy, that's not the React way.

mikethompson00:07:40

The code fragment you have supplied looks fine. What surrounds that if? a [:div ...] ? How does password get passed in? subscription? Can you add a [:pre (pr-str @password)] nearby so you can be sure it is changing value? It does seem clear that the value in password isn't getting set correctly.

Petrus Theron10:07:21

Can reagent components have multiple arity?

Petrus Theron10:07:03

@mikethompson: check that password is a ratom and not a regular atom. This gets me all the time.

mikethompson10:07:19

@coyotespike: see line above (meant for you, not me, i think)

coyotespike12:07:42

I did get dommy to work - the save-button calls a save function in another file, which on success uses dommy/hide! and so on. But I admit it's hackity.

coyotespike12:07:21

@zoldar I did not know about deref'ing only once...let me try that.

coyotespike12:07:16

So the password form should update the password atom should update the buttons.

coyotespike13:07:23

Also, unlike every other atom, the password is not a subscription, and hence is not updated directly through a handler, which would probably make it easier (I don't want it in my app-db/BigRatom). @petrus so it is a ratom, but that shouldn't matter here. 😬

mikethompson13:07:10

@coyotespike: honestly, don't use dommy. In this world, its not a hack, it's a full on abomination. I'd encourage you to figure out the bug.

coyotespike14:07:03

It was a desperate move, I assure you! I am continuing to mess with it.

coyotespike16:07:24

Figured out the issue with the password atom not updating! I made the Form-2 Rookie Mistake and didn't use an inner (fn [] ...you'd think I'd know better 😵...https://github.com/Day8/re-frame/wiki/Creating-Reagent-Components

coyotespike16:07:21

Many thanks to everyone who chimed in!

coyotespike16:07:35

Still working on the switching buttons thing...

coyotespike17:07:03

@mikethompson - the switching buttons work! And yes, it's much prettier. Thanks for the encouragement and advice (and for Re-frame!) @zoldar: It only works for me when I deref the atom in each button and function. I'd be curious to see an example where you needed to deref in the let.