Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: day8/re-frame
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: condense/re-frame
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Jul 26, 2020

  1. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    c81ed37 View commit details
  2. Clear the sub cache if a sub is overwritten

    Note: slightly hacky to keep it isolated and avoid dealing with circular refs
    olivergeorge committed Jul 26, 2020

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    57959c2 View commit details
Showing with 8 additions and 3 deletions.
  1. +1 −1 src/re_frame/registrar.cljc
  2. +7 −2 src/re_frame/subs.cljc
2 changes: 1 addition & 1 deletion src/re_frame/registrar.cljc
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@
[kind id handler-fn]
(when debug-enabled? ;; This is in a separate when so Closure DCE can run
(when (and (not (settings/loaded?)) (get-handler kind id false))
(console :warn "re-frame: overwriting" (str kind) "handler for:" id))) ;; allow it, but warn. Happens on figwheel reloads.
#_(console :warn "re-frame: overwriting" (str kind) "handler for:" id))) ;; allow it, but warn. Happens on figwheel reloads.
(swap! kind->id->handler assoc-in [kind id] handler-fn)
handler-fn) ;; note: returns the just registered handler

9 changes: 7 additions & 2 deletions src/re_frame/subs.cljc
Original file line number Diff line number Diff line change
@@ -179,7 +179,8 @@
(console :error err-header "expected pairs of :<- and vectors, got:" pairs))
(fn inp-fn
([_] (map subscribe vecs))
([_ _] (map subscribe vecs)))))]
([_ _] (map subscribe vecs)))))
overwriting? (some? (get-handler kind query-id))]
(register-handler
kind
query-id
@@ -214,4 +215,8 @@
subscription))))]

(reset! reaction-id (reagent-id reaction))
reaction))))))
reaction))))

;; If subs are being overwritten we can't trust the subscription cache!
(when overwriting?
(clear-subscription-cache!))))