Fork me on GitHub
#re-frame
<
2016-09-08
>
rorydouglas02:09:22

@mheld total SWAG, but any chance you’re getting bitten by browser auto-filled fields? i have this issue for my re-frame/re-com login popup where the username/password fields are auto-populated by Chrome (visually) but the onChange events don’t fire & so the components still think they’re empty

mheld04:09:24

@rorydouglas I haven't gotten to that yet 😛

rorydouglas04:09:13

@mheld yeah i do actually want autofill on though, i think i need to use componentDidMount to check the contents of the DOM input directly & set it on the field, haven’t had time for that yet

michael.heuberger05:09:53

having a problem with as-element here. prepending it with a let block give me warnings. like that:

(defn button
  [x]
  (let [something 324]
    (r/as-element
      [rui/flat-button ...])))

michael.heuberger05:09:50

any suggestions how to fix this?

am-a_metail08:09:00

@michael.heuberger - any chance of getting the warning text?

vikeri09:09:13

I have been looking around in the documentation but haven’t located best practices on using a subscription as part of input to reg-event-db. How is this done in the most idiomatic/performant way?

martinklepsch11:09:17

@vikeri don't use subscriptions in event handlers. instead factor out functions and use those to build the structure from app-db as needed

vikeri11:09:26

@martinklepsch Alright, just thought that I shouldn’t do any costly function computations in handlers. And since the value already exists I thought I might just get it from the memory. But I already have a function so that is easily accomplished 😄

mbertheau11:09:55

@vikerl that sounds like a sensible API addition: a handler saying I need the current value of this subscription, get it to me cheap if you have it, or compute it. Since the handler is in the middle of modifying app-db though, it could be a point of confusion that the subscription's value is computed using the value of app-db from before the handler started.

lwhorton13:09:51

great idea @martinklepsch thanks for the hint- much simpler than spamming a bunch of messages through reagent. Did you ever figure out a way to attach a class to the element “when hovered” to enable transitions? I never seem to be able to understand closure docs 😕

martinklepsch13:09:17

@lwhorton to which element in particular the tooltip or the hovered element?

lwhorton13:09:45

the tooltip, ideally — i’m doing a simple transform scale(0) -> scale(1), but you can’t get it to work without swapping classes “on-hover"

martinklepsch13:09:30

So Tooltip inherits from PopupBase which implements the following events http://google.github.io/closure-library/api/goog.ui.PopupBase.EventType.html

lwhorton14:09:25

aha, i see.. it’s all there in the docs it’s just hard to translate API scaffolding into meaningful examples. Ill look around and let ya know if I figure it out.

martinklepsch14:09:57

You can add listeners for show/hide and add/remove classes there.

martinklepsch14:09:15

An alternative would be to use setTransition and some transition from goog.fx but I haven't anything like that so not sure how much work that would be

igosuki14:09:39

anyone know an idiomatic way to redirect users after triggering an http-success handler ? re-frame-async-flow-fx doesn’t seem to cut it since you can’t match dispatch vector parameters

martinklepsch15:09:39

@lwhorton what kind of transition did you want to add to the tooltip?

lwhorton15:09:12

i’m still working on it, I got the entering transition to work via adding a listener to Tooltip Events.SHOW, struggling to get the leave animation to work because the mouse handling doesn’t seem to work at all… MOUSELEAVE and MOUSEOUT are never firing when attached via .listen on the Tooltip. instance. @martinklepsch

lwhorton15:09:49

it’s just the transition described in the material ui guide - https://material.google.com/components/tooltips.html#tooltips-interaction

martinklepsch16:09:43

@lwhorton is there a demo iof the behavior somewhere?

martinklepsch16:09:20

I just did something basic with setTransition, works pretty nicely

lwhorton16:09:34

i can’t figure out that transition docs either - just no examples anywhere

martinklepsch16:09:07

so the transition is mostly the scaling of the tooltip?

lwhorton16:09:30

yea, it just scales from the target out to its full size

lwhorton16:09:42

i may have just gotten it working, a painful hour later. 😕

nilrecurring17:09:46

Contextual question: how do you usually make transitions work in re-frame? Is there some common/useful pattern?

danielcompton22:09:35

@nilrecurring you have much the same problems/opportunities as general React

danielcompton22:09:48

not aware of too many patterns, but Redux probably has some good stuff