Fork me on GitHub
#hyperfiddle
<
2024-01-01
>
joshcho05:01:17

happy new years everyone 🎉

🎉 9
Olav Fosse05:01:31

Happy new year Josh!

❤️ 1
grounded_sage11:01:59

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.

grounded_sage11:01:42

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.

grounded_sage11:01:23

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]))))))

grounded_sage12:01:44

(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.

grounded_sage12:01:39

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.

Dustin Getz12:01:09

i suspect a desync, send us the repo

👍 1
Dustin Getz12:01:27

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?

grounded_sage12:01:29

Nope. I'm avoiding hacks as much as possible.

👍 1
grounded_sage12:01:14

I'll see if I can get together a minimum repo so there is less going on.

grounded_sage18:01:04

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.

grounded_sage18:01:17

Meanwhile this works in the same namespace. (e/def live-quotes (e/server (e/watch polygon/!live-value-quotes)))

Dustin Getz18:01:20

yes that looks like a desync bug, which is possible under IC which is still very new

grounded_sage23:01:29

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

grounded_sage17:01:42

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.

Dustin Getz17:01:21

electric-fiddle repo does have IC

grounded_sage17:01:35

Ah okay. I thought it didn’t. Well I will also port across to that for consistency.

Vincent21:01:00

(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?

Vincent21:01:01

Because no e/offload?

Vincent22:01:10

nvm i think it was something else

Vincent00:01:46

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.