Fork me on GitHub
#re-frame
<
2018-09-19
>
caleb.macdonaldblack00:09:35

@b2berry take a look at step 3 https://stripe.com/docs/stripe-js/elements/quickstart. The way we’ve used stripe is creating an element in stripe, calling a function on that element to mount it to a div. And then calling the addEventListener function on that element and giving it a callback. All of this life cycle is managed using a form 3 component

b2berry00:09:06

Thanks caleb. I actually just an hour ago got the stripe react components working which might do the trick.

caleb.macdonaldblack00:09:17

Reflecting on this defining the card element might be best done in the lifecycle of the component

b2berry00:09:51

I might double back and consider your approach using the Stripe Checkout.js solution, which ultimately I wanted to use moreso than Stripe.js and custom route.

caleb.macdonaldblack00:09:40

Okay good luck! 🙂

b2berry00:09:05

Have you had any issues with the event listener not getting removed appropriately?

caleb.macdonaldblack00:09:06

I don’t think so, assuming the lifecycle method :component-will-unmount (or another similar) is set up correctly.

caleb.macdonaldblack00:09:17

Are you running into issues with that are just wondering?

b2berry00:09:29

No, I’d need to take this approach for a test drive. I just get a little uneasy around coordinating listeners. Probably just residual PTSD from many years back in the early jQuery days.

caleb.macdonaldblack00:09:46

mounting and unmounting happens when a component is removed from the view. So as long as you completely remove it from the view the unmount lifecycle should call whatever you give. I’m quite confident in that. In the past we’ve had modals that have had to stay in the view for animations that have caused complications around this though so take that into consideration. As far as the reliability of the create & remove event listeners on the stripe component goes I’m not to sure. I’d assumed it worked correctly. You could test this by removing the event listener manually while the component is in the view and ensure that your events stop firing

b2berry00:09:02

Groovy thanks!

dfcarpenter01:09:26

When working locally is there a way to have http data I fetch hang around on hot-reload?

mikethompson05:09:12

@dfcarpenter Where are you putting this data? If it is in app-db it will hang about

samedhi21:09:29

Is there a way to check if kwd has already been previously registered using (reg-event-fx kwd ...)?

samedhi21:09:36

Have a list of route handler keywords, and want to register a default handler for any route that hasn't yet been registered (if that makes sense).

mikethompson22:09:05

@samedhi there is no officially sanctioned way. As @codonnell indicates, you'd have to reach into the implementation. if you wanted to access the handler for id then: (get-in re-frame.registrar.kind->id->handler [:event id] :not-there))