Merge pull request #336 from Sohalt/master

enforce reg-sub :<- syntax
This commit is contained in:
Daniel Compton 2017-05-01 08:45:32 +12:00 committed by GitHub
commit d70067619b
2 changed files with 14 additions and 6 deletions

View File

@ -1,5 +1,9 @@
## Unreleased
#### Breaking
- - `reg-sub` enforces using `:<-` to indicate subscription inputs. Previously any keyword would have worked here. While using anything other than `:<-` was undefined behaviour previously, this could possibly break some code when upgrading. Thanks to [@Sohalt](https://github.com/Sohalt) [#336](https://github.com/Day8/re-frame/pull/336).
#### Fixes
- `re-frame.interceptor/update-coeffect` has been fixed. [#328](https://github.com/Day8/re-frame/pull/328)

View File

@ -183,14 +183,18 @@
f)
;; one sugar pair
2 (fn inp-fn
([_] (subscribe (second input-args)))
([_ _] (subscribe (second input-args))))
2 (let [[marker vec] input-args]
(when-not (= :<- marker)
(console :error err-header "expected :<-, got:" marker))
(fn inp-fn
([_] (subscribe vec))
([_ _] (subscribe vec))))
;; multiple sugar pairs
(let [pairs (partition 2 input-args)
vecs (map last pairs)]
(when-not (every? vector? vecs)
(let [pairs (partition 2 input-args)
markers (map first pairs)
vecs (map last pairs)]
(when-not (and (every? #{:<-} markers) (every? vector? vecs))
(console :error err-header "expected pairs of :<- and vectors, got:" pairs))
(fn inp-fn
([_] (map subscribe vecs))