This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-05
Channels
- # beginners (135)
- # cider (30)
- # clara (66)
- # cljs-dev (18)
- # cljsrn (6)
- # clojure (115)
- # clojure-austin (1)
- # clojure-dev (10)
- # clojure-italy (7)
- # clojure-nl (1)
- # clojure-spec (18)
- # clojure-uk (26)
- # clojurescript (76)
- # cursive (2)
- # datomic (4)
- # devops (1)
- # emacs (19)
- # fulcro (159)
- # garden (3)
- # klipse (5)
- # leiningen (5)
- # off-topic (61)
- # om (7)
- # pedestal (6)
- # re-frame (17)
- # reagent (73)
- # ring-swagger (6)
- # rum (5)
- # shadow-cljs (60)
- # spacemacs (31)
- # specter (4)
- # vim (8)
- # yada (1)
Question for other re-frame-ers, how would you interop with a js lib that exposes mutable objects and events?
My current idea is to wire up event handlers that forces update, but there could be a better way?
Initially I converted the data into immutable tree and store it app db. Nice to work with but I had to duplicate a lot of data.
@poernahi this may help https://github.com/Day8/re-frame/blob/master/docs/Using-Stateful-JS-Components.md
This may also be useful: https://github.com/binaryage/cljs-oops
Hmm.. in my case, my view components are pure reagent. But my datasource is a chat client object that I can query for channels and messages. So I put this client object in app db. When a new message is received, the object just updates its internal structure and emits an event. My understanding is that this client object will not trigger a subscription reaction when a new message is received. If my view components query directly from this client object, I have to force update when an event is received.
Also the fact that all of the client's API returns promise makes interop rather annoying.. But that's a different problem 🙂
Yes. So the alternative would be to dispatch an event when new chat data arrives, and to store it in app-db
In theory, arriving chat is just another kind of event
, and so should be modeled via a dispatch
Is there any other reason that "Tracing is not enabled Please set re_frame.trace.trace_enabled_QMARK_ true in clojure-defines" might appear
I've set it to true in closure defines
@danieleneal are you using re-natal? I think only the most recent version has support for closure defines
The code is pretty straightforward: https://github.com/Day8/re-frame/blob/9b2a10df2e840e3ce12eb0e3703a9e0458f47b5f/src/re_frame/trace.cljc#L37-L39
Ah thanks I'm using react native but with expo I guess I'll have to figure out how renatal does it and copy across
See also the docs on https://github.com/Day8/re-frame-10x/blob/master/docs/Advanced-Setup.md
If you do set a :main config, then you can see the closure defines in the :main file
In our app I see:
var CLOSURE_UNCOMPILED_DEFINES = {"goog.DEBUG":true,"re_frame.trace.trace_enabled_QMARK_":true,"day8.re_frame.tracing.trace_enabled_QMARK_":true};
var CLOSURE_NO_DEPS = true;
if(typeof goog == "undefined") document.write('<script src="compiled_dev/parts/goog/base.js"></script>');
document.write('<script src="compiled_dev/parts/goog/deps.js"></script>');
document.write('<script src="compiled_dev/parts/cljs_deps.js"></script>');
document.write('<script>if (typeof goog == "undefined") console.warn("ClojureScript could not load :main, did you forget to specify :asset-path?");</script>');
document.write('<script>goog.require("devtools.preload");</script>');
document.write('<script>goog.require("dirac.runtime.preload");</script>');
document.write('<script>goog.require("day8.re_frame_10x.preload");</script>');
document.write('<script>goog.require("figwheel.connect");</script>');
document.write('<script>goog.require("process.env");</script>');
document.write('<script>goog.require("day8.ourapp.main");</script>');
document.write("<script>figwheel.connect.start();</script>");