This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-11-23
Channels
- # aws (3)
- # babashka (17)
- # beginners (44)
- # boot (1)
- # bristol-clojurians (1)
- # cider (19)
- # clj-kondo (7)
- # cljfx (5)
- # clojure (35)
- # clojure-australia (25)
- # clojure-europe (41)
- # clojure-nl (4)
- # clojure-spec (5)
- # clojure-uk (104)
- # clojuredesign-podcast (1)
- # clojurescript (41)
- # component (6)
- # conjure (5)
- # core-async (20)
- # core-logic (5)
- # cryogen (7)
- # cursive (4)
- # data-science (1)
- # datomic (14)
- # devcards (2)
- # events (1)
- # fulcro (6)
- # helix (6)
- # jobs (4)
- # kaocha (4)
- # lambdaisland (4)
- # leiningen (3)
- # luminus (1)
- # malli (2)
- # meander (2)
- # mount (6)
- # off-topic (2)
- # pedestal (25)
- # rdf (1)
- # re-frame (17)
- # reagent (5)
- # releases (1)
- # reveal (13)
- # rewrite-clj (45)
- # shadow-cljs (27)
- # sql (18)
- # tools-deps (93)
- # vim (13)
- # xtdb (11)
Hello Folks! I am trying to build a UI that is updated with information that I receive from another service via file pipe. Ive gotten as far as creating a context that contains the updates from my external service and now I am trying to update the context with the messages as they come in. The project readme wasnt very clear on the use of fx/swap-context. Ive tried using it a few ways and have not been successful. Here is my context and update function (add-json-message):
.......
;; simple permutation of json into label
(defn paint-message
[message]
{:fx/type :label
:text (json/write-str message)})
;; atomic global state for the UI
(def main-context (atom (fx/create-context
{:contacts []
:messages []}
cache/lru-cache-factory)))
(defn add-json-message
[obj]
(fx/swap-context main-context conj :messages (paint-message obj)))
.........
And heres my error:
Caused by: java.lang.NullPointerException: Cannot invoke "java.util.concurrent.Future.get()" because "fut" is null
Can someone help clarify how to properly use swap-context?