Fork me on GitHub
#re-frame
<
2018-06-19
>
danielcompton00:06:45

@lilactown ah right, that's a public API of Reagent, but I see what you mean

decim03:06:37

Can someone tell me why re-frame is treating ‘:http’ as an effect within my function? Error - “re-frame: no handler registered for effect: ” :http “. Ignoring.” Edit: well now i see reg-ex :http created in the memory hole project. I suppose a better question is where would a new programmer focus to even learn he needs to do these things? I’ve been guarded by rails for years so really getting to the bare metal of things is interesting. https://github.com/yogthos/memory-hole/blob/b6fcc86714b6d787118dda1fc28fe3c75d52ff52/src/cljs/memory_hole/effects.cljs#L5 https://gist.github.com/0f7a0424bcc01b9e6e1433896b22893e

gadfly36103:06:24

@decim For any reg-event-fx, it will perform all of the fxs in the hash-map. For example yours has the fx --> :http ... so somewhere, there needs to be a reg-fx for :http. Most people use this: https://github.com/Day8/re-frame-http-fx

decim03:06:30

@gadfly361 I see so you can next effects in a sense. Now i’m tackling the bit of code I saw in the memory hole project. I also noticed http-xrhio in the re-frame documentation. Is that in any way similar to what yogthos wrote? Newbie questions… i’m biting more than I can chew clearly.

gadfly36103:06:34

Not sure where in the re-frame documentation you're looking, but fairly safe to assume it was referring to the aforementioned library because it does indeed expose the :http-xhrio fx

gadfly36103:06:38

@decim yeah, similar to what is in memory hole

gadfly36107:06:36

@decim Haha that is the link I sent you 😂

gadfly36107:06:48

But yes, I think that is what you are after :) I think most people use it

decim07:06:32

@gadfly361 lol, i’m lost all around. i’ll have to come back to this in a few hours. i’m all over the place looking for examples

decim07:06:23

but i believe i did take a few good steps forward. i’m getting new errors now along the lines of ‘cannot write’. i’ll take that as a step in the right direction.

kennytilton11:06:09

@decim As long as the error I am getting is changing I am happy. 🙂

❤️ 1
ScArcher14:06:24

In reframe, I seem to have a lot of events functions that do the same thing. Is it better or possible to write a generic function to handle update events and pass in the data it needs to do the update as function parameters?

ScArcher14:06:50

Currently I’m updating data in a map, but I have an event handler for each update. It seems like I could have a single event handler that just takes the location in the map and the new value.

mikerod14:06:44

@scott.archer I don’ think that it is bad to parameterize event handlers. However, it is not likely a good idea to expose app db structure externally as the arguments to the event handler. Your event handlers should convey their intent at a higher-level than “update the db at this path”.

mikerod14:06:58

this is written in some docs somewhere for re-frame, but I can’t find it

ScArcher14:06:06

Thanks @mikerod that makes a lot of sense. Even though there’s a good bit of repetition, it gives you some separation from the DB implementation to what you are trying to do / update.

mikerod14:06:04

@scott.archer yeah, maybe if you don’t need to expose path info and can make the event names used convey user intent, you may be able to help with some of the redundancy by sharing a handler. It is just something you have to be cautious about overdoing and exposing db details out through the handlers

ScArcher14:06:45

I think I can get away with having 1 handler per “map” in the database instead of one per field.

ScArcher14:06:51

I don’t think for this application it would cause any issues.

ScArcher14:06:06

I only have a few high level maps used for configuration data.

jacob.maine16:06:16

Is there a recommended way to close the re-frame 10x panel from JS? Or to prevent it from starting opened? I'm running Selenium tests and the panel gets in the way.

mikethompson17:06:11

@scott.archer have a read through the first few pages of these docs ... where the discussion is about "user intent" etc ... https://purelyfunctional.tv/guide/re-frame-building-blocks/

👍 1
mikerod17:06:33

@mikethompson I was looking all over for something (I think that) you wrote before. It showed some pattern of trying to be clever and abstract/parameterize a handler (subs or event, don’t remember) too much, but then urges not to do that in the name of making clear intent and not coupling to the db layout etc.

mikerod17:06:55

but none of my searching for it has worked. I’ve read this above link before too, but didn’t think that was the same thing I was remembering

Nick Stares17:06:23

Hey, I wanted to report some information (as per the suggestion in the README) about the expansion triangles bug in re-frame-10x. It happens to me reliably whenever I refresh the page while 10x is open in a detached window. I can fix it by clearing out my local storage, but I have to repeat that every time I accidentally refresh while 10x is open.

mikerod18:06:43

@mikethompson that is exactly what was in my mind. I even know it said “dry”, but it turns out it says “DRYYYY” and I guess GitHub search doesn’t do prefix matching

😂 1
jacob.maine19:06:31

@mikethompson per my question above... what would you recommend for closing 10x programmatically? I'm running tests in IE 10 (yes... have pity). Sending CTRL-H to the browser opens an IE help drawer. Could 10x export a function which dispatches [:settings/show-panel? false]? Or have a button that closes the panel (which might be good for accessibility/discoverability anyway)?

mikethompson20:06:49

@danielcompton see immediately above. Can you tell us again the special programmatic incantation pls.

danielcompton20:06:17

I thought there was a function exported for this, but I can't see one

danielcompton20:06:05

Probably adding the localstorage key to your tests would be best way of making sure it doesn't show up

jacob.maine20:06:06

@danielcompton So open the app (to get the right domain), set the show-panel localstorage key to "false" and reload the app?

danielcompton20:06:51

That doesn’t sound so easy does it? :)

danielcompton20:06:36

Open an issue if there isn’t one already and I’ll look into adding a function to call

mikethompson20:06:48

There was an API incantation

mikethompson20:06:00

@danielcompton actually, maybe it was a dispatch you can do programmatically to make it happen (hiding)

mikethompson20:06:34

mranderson.XXX.YYY/dispatch([:hide])

mikethompson20:06:06

I know you have supplied it previously

danielcompton20:06:30

Yeah that might have been it. A bit ugly though

jacob.maine21:06:33

@danielcompton not so easy, but not the grossest thing I've tried. And best of all it works! I had considered a trick like exporting my own function which called mranderson.../dispatch, but decided against it because I'd need to :require [mranderson...]. Since mranderson is a dev-only dependency, I'd rather keep it out of my production code. Anyway, I'll open a PR. Thanks for the response, and @mikethompson thanks to you too.

jacob.maine21:06:02

@mikethompson Perhaps you were thinking of the trick mentioned in this Issue: https://github.com/Day8/re-frame-10x/issues/181

mikethompson21:06:44

Yeah, that's the one. Hmm. But that's a toggle.

jacob.maine21:06:31

@mikethompson @danielcompton Here's a Pull Request for opening or closing the panel programmatically: https://github.com/Day8/re-frame-10x/pull/210