From 8cf42f57f50f3ee41e74de1754fdb75f80b31775 Mon Sep 17 00:00:00 2001 From: Mike Thompson Date: Fri, 19 Aug 2016 18:20:21 +1000 Subject: [PATCH] Version 0.8.0 --- CHANGES.md | 6 +++--- examples/simple/project.clj | 2 +- examples/todomvc/project.clj | 4 ++-- project.clj | 2 +- src/re_frame/core.cljc | 17 ++++++++++++++--- src/re_frame/interop.clj | 5 +++++ src/re_frame/interop.cljs | 3 +++ 7 files changed, 29 insertions(+), 10 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 231ad55..c2d8c81 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,7 +11,7 @@ Some may even find these new features useful. Joking aside, this is a substantial release which will change how you use re-frame. -##### Headline +#### Headline - re-frame subscriptions are now de-duplicated. As a result, many Signal graphs will be more efficient. The new behaviour better @@ -100,7 +100,7 @@ Joking aside, this is a substantial release which will change how you use re-fra - we now have a logo designed by Sketch Maester @martinklepsch. Thank you Martin! But remember, no good deed ever goes unpunished - we'll be pestering you every time from now on :-) -##### Breaking +#### Breaking - requires Reagent >= v0.6.0 @@ -151,7 +151,7 @@ Joking aside, this is a substantial release which will change how you use re-fra (defn my-logger [& args] (do-something-with (apply str args)) ``` -##### Improvements +#### Improvements - Bug fix: `post-event-callbacks` were not called when `dispatch-sync` was called. - added new API `re-frame.core/clear-post-event-callback` which de-registers a callback diff --git a/examples/simple/project.clj b/examples/simple/project.clj index 8e61c2f..e3393f5 100644 --- a/examples/simple/project.clj +++ b/examples/simple/project.clj @@ -2,7 +2,7 @@ :dependencies [[org.clojure/clojure "1.8.0"] [org.clojure/clojurescript "1.9.89"] [reagent "0.6.0-rc"] - [re-frame "0.8.0-alpha4"]] + [re-frame "0.8.0"]] :plugins [[lein-cljsbuild "1.1.3"] [lein-figwheel "0.5.4-7"]] diff --git a/examples/todomvc/project.clj b/examples/todomvc/project.clj index e1ca202..029704f 100644 --- a/examples/todomvc/project.clj +++ b/examples/todomvc/project.clj @@ -2,8 +2,8 @@ :dependencies [[org.clojure/clojure "1.8.0"] [org.clojure/clojurescript "1.9.89"] [reagent "0.6.0-rc"] - [re-frame "0.8.0-alpha4"] - [binaryage/devtools "0.7.0"] + [re-frame "0.8.0-SNAPSHOT"] + [binaryage/devtools "0.8.1"] [secretary "1.2.3"]] :plugins [[lein-cljsbuild "1.1.3"] diff --git a/project.clj b/project.clj index 36f1294..c0e1cf7 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject re-frame "0.8.0-alpha12" +(defproject re-frame "0.8.0" :description "A Clojurescript MVC-like Framework For Writing SPAs Using Reagent." :url "https://github.com/Day8/re-frame.git" :license {:name "MIT"} diff --git a/src/re_frame/core.cljc b/src/re_frame/core.cljc index 5fae0f0..4b245a9 100644 --- a/src/re_frame/core.cljc +++ b/src/re_frame/core.cljc @@ -1,7 +1,8 @@ (ns re-frame.core (:require [re-frame.events :as events] - [re-frame.subs :as subs] + [re-frame.subs :as subs] + [re-frame.interop :as interop] [re-frame.db :as db] [re-frame.fx :as fx] [re-frame.cofx :as cofx] @@ -118,9 +119,19 @@ " [] (let [handlers @registrar/kind->id->handler - app-db @db/app-db] + app-db @db/app-db + subs-cache @subs/query->reaction] (fn [] - ; XXX + ;; call `dispose!` on all current subscriptions which + ;; didn't originally exist. + #_(->> subs/query->reaction + vals + (remove (set (vals subs-cache))) ;; + (map interop/dispose!) + (doall)) + + ;; reset the atoms + (reset! subs/query->reaction subs-cache) (reset! registrar/kind->id->handler handlers) (reset! db/app-db app-db) nil))) diff --git a/src/re_frame/interop.clj b/src/re_frame/interop.clj index d902c88..67a5403 100644 --- a/src/re_frame/interop.clj +++ b/src/re_frame/interop.clj @@ -61,6 +61,11 @@ [a-ratom f] nil) +(defn dispose! [a-ratom] + "No-op in JVM Clojure, since for testing purposes, we don't care about + releasing resources for efficiency purposes." + nil) + (defn set-timeout! "Note that we ignore the `ms` value and just invoke the function, because there isn't often much point firing a timed event in a test." diff --git a/src/re_frame/interop.cljs b/src/re_frame/interop.cljs index e9d4ac0..5a4967e 100644 --- a/src/re_frame/interop.cljs +++ b/src/re_frame/interop.cljs @@ -31,5 +31,8 @@ (defn add-on-dispose! [a-ratom f] (reagent.ratom/add-on-dispose! a-ratom f)) +(defn dispose! [a-ratom] + (reagent.ratom/dispose! a-ratom)) + (defn set-timeout! [f ms] (js/setTimeout f ms))