Fork me on GitHub
#re-frame
<
2017-06-05
>
jkrasnay01:06:28

Hey all, I’m writing form builder thing with Re-frame. When I drag a new component onto the form, I’m really just dragging a dummy div. When I drop it, I delete the dummy div and add a representation of the component to my app-db, which in turn renders the “real” element on the form. My question is, what would be the best way to focus that new “real” element once it’s first rendered?

minikomi03:06:25

focus as in it has a text input and you want the cursor to be active on the input?

andre06:06:55

hey @sandbags what kind of error?

sandbags08:06:31

@andre i just knew you were going to ask me that and, of course, i had not written it down 🙂 It should be simple enough for me to reproduce though, I'll try and do that in a while and post back the result.

sandbags09:06:42

Anyone ever seen an "eval timed out. no stack trace available." error? Trying to refer to (but not dereference) an atom in the REPL.

jkrasnay11:06:57

I figured it out. In :component-did-mount I check if the component is the latest and focus the DOM node if it is. I wasn’t sure if it’s OK to deref a subscription from within :component-did-mount but I guess it works OK.