This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-04-23
Channels
- # aws (38)
- # babashka (3)
- # beginners (27)
- # calva (47)
- # clj-otel (14)
- # clojure (90)
- # clojure-brasil (9)
- # clojure-europe (36)
- # clojure-nl (1)
- # clojure-norway (17)
- # clojure-uk (6)
- # clojurescript (9)
- # docker (1)
- # emacs (8)
- # fulcro (14)
- # funcool (2)
- # graalvm (6)
- # graphql (5)
- # gratitude (1)
- # holy-lambda (11)
- # honeysql (12)
- # lingy (2)
- # malli (4)
- # missionary (3)
- # off-topic (2)
- # overtone (3)
- # pathom (2)
- # pedestal (20)
- # polylith (2)
- # re-frame (2)
- # remote-jobs (1)
- # shadow-cljs (76)
- # testify (4)
or maybe check out https://www.reddit.com/r/Clojure/comments/1c6hx1t/zero_build_web_components_in_clojurescript/
Hi, I have got same namespaces that works fine with REPL until i reload browser. Once I do i cant create / refer anything in repl for those namespaces. I get error like these: before reload:
some-namespace> (def x 1)
#'some-namespace/x
after reload
some-namespace> (def x 1)
Execution error (TypeError) at (:1).
Cannot set properties of undefined (setting 'x')
:repl/exception!
What is going on?This is what I see in dev console
REPL Invoke Exception TypeError: Cannot set properties of undefined (setting 'x')
at eval (eval at shadow$cljs$devtools$client$browser$global_eval (shadow.cljs.devtools.client.browser.js:1:1), <anonymous>:2:43)
at eval (eval at shadow$cljs$devtools$client$browser$global_eval (shadow.cljs.devtools.client.browser.js:1:1), <anonymous>:3:1257)
at eval (<anonymous>)
at Object.shadow$cljs$devtools$client$browser$global_eval [as global_eval] (browser.cljs:155:5)
at Object.eval [as shadow$cljs$devtools$client$shared$IHostSpecific$do_invoke$arity$3] (browser.cljs:200:8)
at Object.shadow$cljs$devtools$client$shared$do_invoke [as do_invoke] (shared.cljs:23:15)
at shadow$cljs$devtools$client$shared$handle_repl_invoke (shared.cljs:118:14)
at Object.shadow$cljs$devtools$client$shared$interpret_action [as interpret_action] (shared.cljs:173:16)
at shadow$cljs$devtools$client$shared$interpret_actions (shared.cljs:208:8)
at Object.shadow$cljs$devtools$client$shared$continue_BANG_ [as continue_BANG_] (shared.cljs:101:4) Object
its your runtime. Same deal in Clojure, if you restart Clojure the REPL state is also gone
@U05224H0W I am not sure. This is the scenario: 1. I start repl and run browser 2. I define some variable in repl 3. I reload a browser 4. I can’t define a variable or refer anything until I reevaluate the namespace again. The thing is that this is happening only for some namespaces. When i switch to different namespace in REPL then I can define / refer variables even after browser has been reloaded.
as I said reloading the browser wipes all runtime state. there is still some server-side state that "knows" the namespace, but the relevant runtime is gone
this is all a bit abstract. if you give me more details about your setup I can give more precise answers
Ah, right, I see what’s going on. Thank you very much, I’ve adjusted the loading / eval of namespace as I need and it works now. Surprisingly, I haven’t encountered this until now :-)
@U05224H0W Why I see a different error there? What is it telling me?
I cannot comment on 5 different warnings when everything is already in a broken state as far as I can tell
also which shadow-cljs version do you use? there was a bug that sometimes require didn't set up aliases properly
@U05224H0W I use 2.27.1 1. the first warning is coming from Flowstorm - I got rid off it 2. the second one appears once i require Portal The thing is that Portal isn’t in deps.edn dependencies but it can be required. How I got into this state?
This is I why also attached the first screenshot where no other warning happens.
I have got a function on a button and this fn defines a global var (anti-pattern) called updated
and when i try to call this value i get an error which is different from calling undefined var.
this is again really hard to give any kind of advice on without having the full context/code
Yeah, I understand. Unfortunately, I can’t reproduce it now or share the code. It seems to me that the problem starts to appear when I use flow-storm at the same time and the application (running on different address) is so demanding that WS often disconnects from shadow-cljs. Next time I come across this, I’ll upload a loom video, you’ll see that the namespace is usable, but only some variables return that ‘undefined’ error.
an quick example.. https://www.loom.com/share/be3f72090eb4400abb8b7a47e455446b?sid=1bb4f6fd-f43b-40ad-bdc7-7a978f0b66b1
for example I can force this error simply by doing (in-ns 'some.thing.that.does.not.exist)
and then (def a 1)
but regardless the effect is the same since CIDER could be the thing switching the namespace
Otherwise, the repl was in a state that basically nothing worked - but the hot-reload on ns works and the code in the application works normally too. understand it’s maybe too abstract.
basically all I can say is: Cannot read properties of undefined (reading 'events')
means that it is trying to do user_intercace.modules.element_manager.events.a = 1
something that ensures the namespace actually exists before trying to def
an extra var in it
So it remembers that I tried to define “a” and then it returns a different error when I call it than when I try to call something I never tried to define? Interesting
So maybe the flow-storm may have something to do with it…. I’ll try to come up with a reproducible example over the weekend.
I'm not sure what is the current issue since there are many different things on the thread. If the issue is that warning, it is weird, in the sense that I'm not able to reproduce and that code shouldn't be required by anything in cljs land. But anyway that is an easy fix, and should also be harmless.
@U0739PUFQ Sorry, I already updated that message in flow-storm thread.