Fork me on GitHub
#re-frame
<
2016-07-26
>
escherize02:07:54

I've found, for the use of devcards: keeping the app-db isolated is not worth it.

escherize02:07:24

What I do, is for a certain panel, I'll mount just that panel into a devcard, and another panel underneath.

escherize02:07:37

the panel underneath has a few buttons that exercise the panel under test.

escherize02:07:14

so for the login panel, it will fill fields via dispatch, try to submit via disaptch, etc.

escherize02:07:03

basically a list of pure event vectors (like: [:update-signin :user "johnbo"]) that might look like this:

escherize02:07:20

{:signin-not-matching-pws
  [[:reset-app-state]
   [:update-signin :user "johnbo"]
   [:update-signin :email  ""]
   [:update-signin :pw1 "johnbo"]
   [:update-signin :pw2 "johnbo-notmatching"]
   [:signin]]}

escherize02:07:23

then a view simply has buttons with the vals of that structure, and when clicking the button, uses doseq and js/setTimeout to dispatch those events in that order.

shaun-mahood16:07:52

@escherize: That sounds like a good approach, thanks! We had a bit more discussion in #C09GR9UJC as well if you are interested. I'm definitely going to experiment with the way you've been using devcards as I think it would be a really good fit for one of my older projects.

zackbleach17:07:56

Hey, I have a beginner re-frame question: What’s the best way to preload an image I have access to before a component renders but not when my application starts? The ideas I've had are: * Use the js interop and create an image object as soon as I know the image URL which I could pass in to a my component at render time, but I don't know how to use an image object with Hiccups. * "Render" the component as soon as I know the image URL but set the style to "display=none". When I need to actually render the component update the display. Are there any better ones?

shaun-mahood18:07:26

@zackbleach: I've ended up using the "display=none" route quite a few times for other situations and been pretty happy with it. It's much nicer doing it with re-frame than without, I've just set up a handler that fires when loading starts and another when it's ready to render. You might be able to adapt some of the ideas from https://github.com/Day8/re-frame/wiki/Subscribing-To-A-Database as there seems to be a bit of overlap there, but that might be a stretch.

zackbleach19:07:57

@shaun-mahood: I've just set up a handler that fires when loading starts and another when it's ready to render that’s exactly what I going to do (good to know I’m thinking about this in the right way). Thanks for the link!

shaun-mahood19:07:22

@zackbleach: No problem, keep on asking if you've got more questions - it's a really friendly and helpful channel.