Fork me on GitHub
#re-frame
<
2018-07-06
>
kennytilton03:07:13

I just gave re-frame.http-fx a try. Seems nice, but I had my custom service return a 422 response code on incorrect inputs, and the “result” passed to my failure handler does not include the response code so I cannot differentiate it from the service not being available or whatever. Am I missing something? I need some way to get at the raw response, I guess.

p-himik05:07:52

@eoliphant Components should definitely not fire events by themselves. Is it possible to use something from https://github.com/Day8/re-frame/blob/master/docs/Subscribing-To-External-Data.md with the HOC?

p-himik05:07:07

@hiskennyness Hmm, judging by the sources, the error code should be in :last-error-code. Do you not have that key at all?

p-himik05:07:44

@hiskennyness Ok, :last-error-code is something else, however http-fx "0.1.6" gives me this in my error handler:

p-himik05:07:32

[:response "422 Unprocessable Entity"]
[:last-method "GET"]
[:last-error "Unprocessable Entity [422]"]
[:failure :error]
[:status-text "Unprocessable Entity"]
[:status 422]
[:uri ""]
[:debug-message "Http response at 400 or 500 level"]
[:last-error-code 6]

kennytilton08:07:06

I am at 0.1.6. What does your :http-xhrio look like? I have

{:method          :get
                        :uri             uri
                        :response-format (ajax/json-response-format {:keywords? true})
                        :on-success      [:scramble-check]
                        :on-failure      [:scramble-http-failure]}

p-himik08:07:30

Oh, I used ajax/raw-response-format.

kennytilton08:07:33

The handler for :scramble-http-failure gets just “result” which is fairly anemic.

p-himik08:07:05

Most likely, json-response-format just strips away most of the data.

kennytilton08:07:39

Thx. That explains that. I did not see other formats documented.

Bravi12:07:46

hi everyone. I created this little javascript prototype library that mimics re-frame https://github.com/Bravilogy/rainstate

Bravi12:07:34

I’m planning to use it on an upcoming React project. will see how it goes 🙂

Drew Verlee12:07:46

I’m doing some intiial research, is there anything like RxFiddle for reframe? It’s possible this question makes no sense, let me know if you have looked into the cross section between re-frame and rx-fiddle: > Introducing RxFiddle: RxFiddle is designed to help with these objectives by providing a visual overview of Observable flows, and also detailed views inside the data flows at an event level. RxFiddle therefore contains a data flow graph visualiser, and a dynamic Marble diagram generator. It looks like this:

zalky13:07:17

Hi, is anyone able to get the "path-inspector" to work in re-frame-10x? Doesn't seem to work for me (v 0.3.3).

talgiat13:07:36

I’m running into issues when running spec validation as an interceptor. Usually when the app starts not all keys in the db are populated, as we have to fetch some data from different backend services. We can always validate and set the keys that are not populated as optional, but once we have fetched the data we don’t want these keys to be optional anymore. For example, if some handler removed a key that was populated by mistake we want the spec validation to catch that. It almost looks like we want different specs for different app states. Does anyone have ideas on how to handle such cases?

p-himik14:07:35

@zalky Path inspector works only after you fire some event, and it shows you paths in app-db after the changes after the event.

zalky14:07:42

@p-himik: I'm seeing some pretty odd behaviour atm. I'm getting a console error:

Uncaught TypeError: Cannot read property 'document' of null
    at day8$re_frame_10x$events$open_debugger_window (events.cljs:287)
    at events.cljs:298
    at mranderson048$re_frame$v0v10v2$re_frame$std_interceptors$fx_handler__GT_interceptor_$_fx_handler_before (std_interceptors.cljc:133)
etc...
And now the db inspector does not want to load anything. The app seems to work fine, and I'm working on a commit that I know previously worked with the db-inspector. It seems that somehow re-frame-10x is just nerfed... I've tried multiple previous commits, rebooting the build, clearing out target files... I'm stumped.

p-himik14:07:38

@zalky You'll have to follow up with the devs on this one - I have no clue. The only thing that comes to mind is that there're two versions of re-frame-10x, 0.3.3 and 0.3.3-react16. Maybe you're using an incorrect one.

manutter5114:07:33

I’ve seen the “cannot read property ‘document’ of null” message sometimes too, but it seems to be relatively harmless most of the time. I did see one weird thing: I added localhost to my list of sites that are allowed to use popups in my Chrome settings, and suddenly my 10x debug window popped open even though I’d previously had it closed. The “document of null” message went away after that, at least for a time.

manutter5114:07:46

Haven’t been able to reproduce that since, tho, so :thinking_face:

zalky14:07:21

@p-himik: appreciate the response! While it did not fix the issue, I had updated react recently and the dep was out of sync.

zalky14:07:14

@manutter51 brilliant, the popup behaviour of re-frame-10x did seem to be the culprit. I had not too long ago tested out the "pop out" floating window, during which time the browser refreshed, which nerfed the 10x session. Then it has been trying to pop out ever sense, and I never noticed that the popup blocker was preventing it from doing so.

manutter5114:07:40

Interesting, glad that helped

👏 4
p-himik14:07:55

@zalky That's probably worth "documenting" as a GH issue. 🙂

👍 4
lwhorton19:07:47

so for a long time i’ve been using

(reg-sub
:something
:something)
as an extremely opaque method to be cheeky for subscriptions in the db. since the kw :something just takes the db value and returns (get db :something) it works fine.

lwhorton19:07:25

but just recently I noticed this doesn’t seem to work anymore… and I don’t know when that changed, and I don’t see any reason why it would change. does this work for others?

lwhorton19:07:41

it seems that if the db value at :something is not defined (as in a plain ol empty map {}), the subscription returned is actually [:something] instead of nil