This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-12-24
Channels
- # adventofcode (13)
- # beginners (163)
- # boot (8)
- # cider (1)
- # clojure (86)
- # clojure-germany (1)
- # clojure-italy (2)
- # clojure-spec (66)
- # clojure-switzerland (1)
- # clojure-uk (25)
- # clojured (1)
- # clojurescript (58)
- # core-async (1)
- # cursive (4)
- # datomic (11)
- # events (1)
- # funcool (3)
- # hoplon (86)
- # off-topic (8)
- # om (11)
- # onyx (1)
- # protorepl (7)
- # re-frame (15)
- # ring-swagger (4)
@jumblerg sounds interesting
lol, pretty much
hey, so at some point my live reload from reload
boot task broke
i don’t really remember when
what are the minimum requirements for that?
i used to see the little cljs logo popup when i made changes, even that has gone now 😞
Reload broke for me when I started using web workers. It appears to inject code into the page that doesn’t work in a web worker context.
@candera yeah, reload not compatible with workers
when i was experimenting with web workers i used a separate cljs.edn
the problem is the reload wcode depends on window
which doesn't eexist in the worker context
(the global object is a Worker, not a Window)
i think i have my working setup in git somewhere, i'll check
i had reload going for the non-worker code
I am using a separate cljs.edn, because I have to use simple optimizations in my worker for some reason I can’t remember.
@candera https://github.com/alandipert/lbbasic/tree/b7a7ea1064d6d62b17ba918ea3833d635cc2b8e6
Hmm. Apparently no I don’t - works now. Wonder if I changed it chasing the reload thing. Awesome! My program just got faster. 🙂
@alandipert Oh cool!
oh right, using simple optimizations in worker.. also because :none is dependent on window
which kinda stinks because, no source maps in web worker code 😞
giving the experience a very 2012 feel
I just changed it to advanced and it works, though. But yes, I believe that was the reason I switched.
Huh. Reload not working. Weirder, I’m getting an error message about a page other than the one I have loaded.
@candera This was created today: https://github.com/adzerk-oss/boot-reload/pull/110
oh neat! tiny change too
But the problem with reload right now does not seem related to web workers. I’ve punted it once again, as hitting refresh is not a big deal for me.
Latest problem that people had with reload is related to boot 2.7.0 removal of :target-path as explained at https://github.com/adzerk-oss/boot-reload/issues/106
I did a bunch of small things to have reload working and I really like it now. Before I just did what micha says and did a full window reload but I find that flow disturbing now
(ns github-client.core
(:require
[devtools.core]
[github-client.page.core :as page]
[github-client.reducer :as reducer]
[github-client.handler.core :as handler]
[github-client.route :as route]
[github-client.state :as state]
[hoplon.core :as h :refer [defelem case-tpl cond-tpl for-tpl if-tpl when-tpl]]
[hoplon.jquery]
[javelin.core :as j :refer [cell] :refer-macros [cell= defc defc=]]))
(defonce
_one-time-side-effects
(do
(enable-console-print!)
(devtools.core/install! [:custom-formatters :hints :async])
(state/restore-and-watch-db)
(route/init! state/db)
(state/start-sync-title)
(h/do-watch state/title
(fn [old new]
(set! (.-title js/document) new)))
(reducer/start! handler/global state/db reducer/queue)
(reducer/dispatch reducer/queue [:init])
))
(defn init! []
(reducer/stop! reducer/queue)
(reducer/start! handler/global state/db reducer/queue)
(js/jQuery #(.replaceWith (js/jQuery "#app") (page/show {:db state/db :queue reducer/queue}))))
(init!)
Well every once and while I do a full page reload and my machine has 16GB of ram so not a big problem so far.
Also there is only one cell that has a datascript db created on a defonce
, others are formula ones that will create garbage that will not be collected.
But they are scoped on the page/show
and there is no risk of stale references I think.
I'm trying a global db for a change, I'm happy with it so far. I think I will be able to push a initial version later today.
Not that I wasn't happy with local cells before but I'm trying to setup a way to debug stuff where users could send me the db, I could load it and see what happened.
@mynomoto: that's very interesting, how do you feel about single atom state?
@flyboarder Well trade-offs as always. If your app don't have views that share data I don't think there is a reason to do it and each view would be happy with local state. But if you can have stale things on a view because it was updated on another and you don't want to make requests each time you change views the global state helps.
Having a central event handler also helps to have one place to debug order of events and if they happened at all. I'm pretty happy with that.
if you have say formula cells that are global or are scoped to some part of your program but accessed in multiple components etc
the thing i don't like about single atom state is that you can't have anonymous things in there
How is it no longer a single atom state? Formula cells are derived state no? So the only canonical state there is is the single cell no?
I do have anonymous formula cells in this setup, I don't follow the part about not having anonymous things.
I'm still not sure about performance on low end devices but so far it works in my machine which doesn't mean much.
my thinking is that local state, anonymous cells, etc facilitate composition by encapsulating state at different levels of abstraction
Well the other way they would need to share cells right? Something is needed anyway.
@micha im trying to get my boot-nodejs server task to restart whenever the server file changes but not have it interfere with the rest of the pipeline
I'm currently trying to figure out when to restart the server, how do I track the one file?
I was modeling it after how the hoplon task tracks files