Fork me on GitHub
#nextjournal
<
2022-03-31
>
mkvlr06:03:10

hey @mauricio.szabo, this is a fine place to ask.

mauricio.szabo12:03:24

Thanks! I was wondering if someone had experiences with @testing-library/react-native and freerange. If I render the component with provide-frame, the rendered component does not get the latest frame. Worse yet, bind-frame does work but it's synchronous, so I can't test async info with freerange because the moment an event/context comes back, the frame is already gone... any tips?

mauricio.szabo13:03:44

Also, after creating the frame with make-frame, I'm registering the built-in effects and coeffects with register-built-in! calls. Do I have to cleanup them after each testcase?

mkvlr13:03:52

@mauricio.szabo can you hang on to the frame in a lexical scope?

mkvlr13:03:35

and use it in an event handler

mauricio.szabo13:03:30

I kinda can, but I'm adding freerange on a codebase that already have react with a different framework, and I kinda don't want to mess up with the code outside the Clojure world...

mkvlr13:03:27

not following completely. I don’t think there’s a way of avoiding passing the frame to the event handlers.

mkvlr13:03:53

like where you call re-frame/dispatch

mauricio.szabo14:04:18

Well, I was using re-frame.context as the way to dispatch/subscribe things, and I was getting the frame implicitly by rendering my reagent component with [re-frame.context/provide-frame [my-reagent-component ...]]

mauricio.szabo14:04:33

I'm not sure if this is the right way to do it...

mkvlr15:04:33

yes that's right but you need to handle event handlers differently since they don't have access to the frame provided via react context anymore unfortunately.