This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-01-01
Channels
Unsure what happened but the IC version of electric has broken nearly all my PixiJS and D3 code. Things sometimes render and sometimes don't.
I don't get errors. Just values seem to become non-existent and functions not called. I'm doing many printlns but the behaviour of sometimes rendering and sometimes not is throwing me.
My only theory is that IC doesn't like this kind of code.
(e/def datetime-scale
(e/client
(let [datetime-range (or dynamic-datetime-range static-datetime-range fixed-datetime-range)]
(->
(d3-scale/scaleTime)
(.domain (clj->js datetime-range))
(.range (clj->js [0 panel-w]))))))
(dom/div
(dom/p (dom/text (str (.ticks price-scale))))
(dom/p (dom/text (str (.ticks datetime-scale)))))
Only one of these will render at a time. If I comment out one the other renders. If I have both of them active only the first will render.I also need to have these values rendering to the dom for the values to be passed to my PixisJS draw function. Otherwise the values are not there. Even my println's inside the let bindings of an e/client before the function call do not print out the values. It only properly renders the values when it is written to the dom.
last time this happened to you, there were websocket configuration shenanigans in your repo (local dev build hacked to connect to prod hosted backend), does the repo have anything like that?
I'll see if I can get together a minimum repo so there is less going on.
When I do a watch on a serverside atom on IC branch I get a number instead of the value.
(defonce !positions (atom "hello"))
(e/def positions (e/server (e/watch !positions)))
Result is 1700659560000
Could this possibly be the same issue? Wondering if you may need the whole repo and not just a slimmed down one.Meanwhile this works in the same namespace.
(e/def live-quotes (e/server (e/watch polygon/!live-value-quotes)))
yes that looks like a desync bug, which is possible under IC which is still very new
I just saw the fiddle repo. Mine is a merge of IC branch against the OG electric-starter and there could be some errors or missing updates on my side from that. I'll see about a migration to the fiddle and it may resolve my issues
I am cleaning this all up and actually going to share the repo with what I have instead of porting to fiddle repo since that doesn't have IC yet.
One thing I noticed is that when doing (e/def live-quotes ...)
I can't arbitrarily use that in frontend of backend. When I reference live-quotes
in a component it needs to be wrapped in (e/server ..)
. Is this the expected behaviour?
I will also put together a list of what I find with a supporting video if that is also necessary to aid in description.
electric-fiddle repo does have IC
Ah okay. I thought it didn’t. Well I will also port across to that for consistency.
(edit: nvm) So I have this problem where I think I'm smart sometimes...
(e/defn TestArea []
(e/client
(ui/button
(e/fn []
(e/server (lets-make-a-test-product)))
(dom/props {:class "xt1"})
(dom/text "Fashion a test product"))))
and I define lets-make-a-test-product
as a fn
#?(:clj (defn lets-make-a-test-product [] ...))
But I get Unable to resolve symbol: lets-make-a-test-product
Why could this be?The problem was that I forgot to include clojure.string :as str
in the requirements and it was breaking on not knowing str
but would report the earliest invoking component as the culprit. just a head's up in case you see something weird, start removing layer by layer until you find the actual exception.