Merge pull request #167 from Day8/no-diff-log
middleware/debug: Log a single line if app-db not changed by a handler
This commit is contained in:
commit
7be581d215
|
@ -1,3 +1,8 @@
|
|||
## Unreleased
|
||||
|
||||
Improvements
|
||||
- `debug` middleware logs a single log line instead of a group if there is no difference in app-db between before and after running the handler.
|
||||
|
||||
## 0.7.0 (2016-03-14)
|
||||
|
||||
Breaking:
|
||||
|
|
|
@ -47,11 +47,14 @@
|
|||
[db v]
|
||||
(log "Handling re-frame event: " v)
|
||||
(let [new-db (handler db v)
|
||||
diff (data/diff db new-db)]
|
||||
(group "clojure.data/diff for: " v)
|
||||
(log "only before: " (first diff))
|
||||
(log "only after : " (second diff))
|
||||
(groupEnd)
|
||||
[before after] (data/diff db new-db)
|
||||
db-changed? (or (some? before) (some? after))]
|
||||
(if db-changed?
|
||||
(do (group "clojure.data/diff for: " v
|
||||
(log "only before: " before)
|
||||
(log "only after : " after))
|
||||
(groupEnd))
|
||||
(log "clojure.data/diff no changes for: " v))
|
||||
new-db)))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue