Fork me on GitHub
#fulcro
<
2020-05-27
>
mruzekw02:05:24

Has anyone had any success with connecting an electron app to the fulcro ispect app?

mruzekw02:05:34

This is my shadow-cljs build config

:builds {:desktop-main {:target :node-script
                        :output-to "resources/main.js"
                        :main app.desktop.main.core/main}

         :desktop-renderer {:target :browser
                            :output-dir "resources/public/js"
                            :asset-path "js"
                            :modules {:renderer {:init-fn app.desktop.renderer.core/init}}
                            :js-options {:keep-native-requires true
                                         :extensions [".web.js" ".js" ".json"]
                                         :resolve    {"react-native" {:target :npm
                                                                      :require "react-native-web"}}}
                            :dev        {:closure-defines {com.fulcrologic.fulcro.inspect.inspect_ws/SERVER_PORT 8237}}
                            :devtools   {:preloads [com.fulcrologic.fulcro.inspect.websocket-preload]}}}}

mruzekw02:05:39

I'm currently getting this error ^

mruzekw02:05:57

Ahhh, I'm guessing this has to do with the fact that electron grabs the app via "file://" and not an http server...

mruzekw02:05:09

Has anyone worked around this?

mruzekw02:05:43

Looking at the source we could pass in

:protocol       ; Server protocol, e/o #{:http :https}.
to sente/make-channel-socket-client!

tony.kay03:05:16

@mruzekw Ah interesting…don’t think I had tried that

tony.kay03:05:54

there are instructions for building inspect in the inspect repo..feel free to tinker. Be careful about pinning it to one value, though. If websocket is used in browser, it would have to adapt between http and https (I think? mixed content policy?)

mruzekw17:05:51

Okay, thanks, will give it a try. I'll send a PR if I get something working

mruzekw22:05:03

@U0CKQ19AQ Figured out com.taoensso/sente 1.15.0 doesn't respect the host param, but v1.16.0-alpha1 does. And it works! I'll use that locally until you decide to bump it in fulcro

tony.kay22:05:58

ah, great. thanks. So just the version bump does it?

tony.kay23:05:25

yeah, my collaborator currentoor sent that patch…I’m aware of the problem…just didn’t think about it w/respect to your issue

tony.kay23:05:37

because you were talking protocol, not host

mruzekw23:05:16

Oh, hmm, let me double check, because I was overriding fulcro to a local version as well

mruzekw23:05:15

Okay, yes, providing a protocol does matter, otherwise it will pull what's in the window location

mruzekw23:05:36

In my test I provided :http and it worked

mruzekw23:05:04

But as you said, we should probably account for either? And if file: feed it one or the other?

mruzekw23:05:40

--- a/src/main/com/fulcrologic/fulcro/inspect/inspect_ws.cljs
+++ b/src/main/com/fulcrologic/fulcro/inspect/inspect_ws.cljs
@@ -35,6 +35,11 @@
         {:type           channel-type
          :host           SERVER_HOST
          :port           SERVER_PORT
+         :protocol       (let [enc-protocol (:protocol (enc/get-win-loc))]
+                           (cond
+                             (= enc-protocol "http:") :http
+                             (= enc-protocol "https:") :https
+                             :else :http))
          :packer         (make-packer {:read  inspect.transit/read-handlers
                                        :write inspect.transit/write-handlers})
          :wrap-recv-evs? false

mruzekw23:05:06

This is the patch I'm thinking. Match up http and https if that's the case, otherwise default to http

mruzekw23:05:43

Another option might be to have a fulcro starter for electron using ses.loadExtension(path) to load fulcro-inspect as a chrome extension

mruzekw22:05:10

@U0CKQ19AQ Let me know your thoughts on the above when you have a moment.

murtaza5207:05:25

I had this scenario which I am not able to reason about. I was doing a mutation which performed a datomic operation. However because the result of the datomic operation was being returned, transit was failing to serialize it and threw an error. However interestingly the datomic transaction did not go through, the wite did not succeed because transit serialization was failing. That doesnt make sense, why would datomic transaction not commit, if a subsequent expression (transit serialization in the ring middleware) was failing ?

Jakub Holý15:05:37

If it doesn't make sense then perhaps it is not what is truly happening? Could you be getting 2 separate transit errors?

zilti10:05:34

Workspaces is currently broken, is that correct? I get TBD, classpath indexing is gone.

thheller10:05:38

oh. I forgot that workspaces has a custom shadow-cljs target. that needs to be updated.

folcon10:05:41

To anyone who want’s to join our little fulcro study group, we’re meeting in around 30 mins =)…

folcon10:05:24

Pinging you @U0522TWDA as you’ve expressed interest =)…

Jakub Holý10:05:18

Thanks! Unfortunately we have a work meting at 13 😞 Next time!

4
codonnell11:05:19

Going to restart my computer @U0JUM502E, issue is not only hangouts

folcon11:05:34

Cool 😃… See you soon!

jorda0mega16:05:48

is there a way to follow this study group? I'm a newbie in fulcro and would love to see how you guys/gals approach the learning process for it

folcon19:05:02

Well you can join our calls?

jacklombard19:05:30

I would be really interested too, can we get meeting invites?

folcon20:05:03

No problem =)… I usually just update a thread like this with a link like I’ve done previously =)… I’m keeping it low touch as I don’t want to bug people who aren’t really interested any more… I’ll @ anyone who’s asked next week when I put a new call link up!

🙏 8
folcon11:06:23

Hey, Just a heads up that we’ll be having our call in a bit to anyone who can join. Pinging those who’ve expressed interest =)… @U0522TWDA @U0DUNNKT2 @U04VBBS6N @U014BBTEFK6

folcon11:06:40

We’ll be starting in 30 mins =)…

Jakub Holý12:06:34

Sorry, mobprogramming day at work

jorda0mega13:06:46

ah it looks like we are on different time zones 😞. thanks for the heads up

folcon13:06:50

Sorry :(… To be fair today was really quick because there was just two of us this time… We’re not too strict with a fixed time as sometimes people need 10 mins or more to wrap something up. I’ll do the heads up again next week!

jorda0mega20:06:16

no worries, understandable. thank you!

zilti10:05:11

Yea it works "the oldschool way" (though I have a bunch of other problems, but oh well)

thheller10:05:53

sorry about that. I'll see if I can put together a PR for this later if I have some time

zilti10:05:37

👍 it is a minor thing really, but if that is something that needs more time, maybe it should be mentioned in the readme

zilti11:05:43

When I have ::f.portal/wrap-root? set to true, my component doesn't get rendered at all, only when I set it to false.

Björn Ebbinghaus16:05:08

I used the http://material-ui.com react components in the last days and decided to bundle the fulcro wrappers in a lib: They are far from complete, I only added what I needed. Feel free to extend. https://github.com/MrEbbinghaus/fulcro-material-ui-wrapper They are using reader conditionals for when someone is writing SSR compatible components. (they are emitting nil in that case)

🎉 24