Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support MapEntry in MapCursor #904

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Support MapEntry in MapCursor
danjohansson committed May 22, 2018
commit 9ca006c4251726165634d208e379325ce8dc7143
14 changes: 9 additions & 5 deletions src/main/om/core.cljs
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@

;; marker protocol, if set component will check equality of current
;; and render state
(defprotocol ICheckState)
(defprotocol ICheckState)

;; =============================================================================
;; Om Protocols
@@ -204,7 +204,7 @@
(-get-state owner))
([owner korks]
{:pre [(component? owner)]}
(let [ks (if (sequential? korks) korks [korks])]
(let [ks (if (sequential? korks) korks [korks])]
(-get-state owner ks))))

(defn get-shared
@@ -315,7 +315,7 @@
(and (cursor? cursor) (cursor? next-cursor)
(not= (-path cursor) (-path next-cursor )))
true

(not= (-get-state this) (-get-render-state this))
true

@@ -625,7 +625,11 @@
ISeqable
(-seq [this]
(when (pos? (count value))
(map (fn [[k v]] [k (-derive this v state (conj path k))]) value)))
(map (fn [[k v]]
(if (exists? cljs.core/IMapEntry)
(MapEntry. k (-derive this v state (conj path k)) nil)
[k (-derive this v state (conj path k))]))
value)))
IAssociative
(-contains-key? [_ k]
(-contains-key? value k))
@@ -1103,7 +1107,7 @@
customize f. In addition om.core/root supports the following
special options:

:target - (required) a DOM element.
:target - (required) a DOM element.
:shared - data to be shared by all components, see om.core/get-shared
:tx-listen - a function that will listen in in transactions, should
take 2 arguments - the first a map containing the