Skip to content

Commit

Permalink
updated versions, fixed a few things that broke with 0.5.0, needs a n…
Browse files Browse the repository at this point in the history
…ew version of websockets still
  • Loading branch information
awkay committed Jun 3, 2016
1 parent db4e4e6 commit 6a0fbcf
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 24 deletions.
2 changes: 1 addition & 1 deletion recipes/background-loads/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[com.cemerick/piggieback "0.2.1"]
[org.clojure/tools.nrepl "0.2.12"]
[juxt/dirwatch "0.2.3"]
[navis/untangled-client "0.5.0-SNAPSHOT" :exclusions [cljsjs/react org.omcljs/om]]
[navis/untangled-client "0.5.0" :exclusions [cljsjs/react org.omcljs/om]]
[navis/untangled-server "0.4.8"]
[navis/untangled-spec "0.3.6"]
[navis/untangled-datomic "0.4.9" :exclusions [com.datomic/datomic-free org.clojure/tools.cli]]]
Expand Down
2 changes: 1 addition & 1 deletion recipes/error-handling/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[com.cemerick/piggieback "0.2.1"]
[org.clojure/tools.nrepl "0.2.12"]
[juxt/dirwatch "0.2.3"]
[navis/untangled-client "0.5.0-SNAPSHOT" :exclusions [cljsjs/react org.omcljs/om]]
[navis/untangled-client "0.5.0" :exclusions [cljsjs/react org.omcljs/om]]
[navis/untangled-server "0.4.8"]
[navis/untangled-spec "0.3.6"]
[navis/untangled-datomic "0.4.9" :exclusions [com.datomic/datomic-free org.clojure/tools.cli]]]
Expand Down
2 changes: 1 addition & 1 deletion recipes/lazy-loading-visual-indicators/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[com.cemerick/piggieback "0.2.1"]
[org.clojure/tools.nrepl "0.2.12"]
[juxt/dirwatch "0.2.3"]
[navis/untangled-client "0.5.0-SNAPSHOT" :exclusions [cljsjs/react org.omcljs/om]]
[navis/untangled-client "0.5.0" :exclusions [cljsjs/react org.omcljs/om]]
[navis/untangled-server "0.4.8"]
[navis/untangled-spec "0.3.6"]
[navis/untangled-datomic "0.4.9" :exclusions [com.datomic/datomic-free org.clojure/tools.cli]]]
Expand Down
2 changes: 1 addition & 1 deletion recipes/lists/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[com.cemerick/piggieback "0.2.1"]
[org.clojure/tools.nrepl "0.2.12"]
[juxt/dirwatch "0.2.3"]
[navis/untangled-client "0.5.0-SNAPSHOT" :exclusions [cljsjs/react org.omcljs/om]]
[navis/untangled-client "0.5.0" :exclusions [cljsjs/react org.omcljs/om]]
[navis/untangled-server "0.4.8"]
[navis/untangled-spec "0.3.6"]
[navis/untangled-datomic "0.4.9" :exclusions [com.datomic/datomic-free org.clojure/tools.cli]]]
Expand Down
2 changes: 1 addition & 1 deletion recipes/paginate-large-lists/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[com.cemerick/piggieback "0.2.1"]
[org.clojure/tools.nrepl "0.2.12"]
[juxt/dirwatch "0.2.3"]
[navis/untangled-client "0.5.0-SNAPSHOT" :exclusions [cljsjs/react org.omcljs/om]]
[navis/untangled-client "0.5.0" :exclusions [cljsjs/react org.omcljs/om]]
[navis/untangled-server "0.4.8"]
[navis/untangled-spec "0.3.6"]
[navis/untangled-datomic "0.4.9" :exclusions [com.datomic/datomic-free org.clojure/tools.cli]]]
Expand Down
2 changes: 1 addition & 1 deletion recipes/recipe-template/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[com.cemerick/piggieback "0.2.1"]
[org.clojure/tools.nrepl "0.2.12"]
[juxt/dirwatch "0.2.3"]
[navis/untangled-client "0.5.0-SNAPSHOT" :exclusions [cljsjs/react org.omcljs/om]]
[navis/untangled-client "0.5.0" :exclusions [cljsjs/react org.omcljs/om]]
[navis/untangled-server "0.4.8"]
[navis/untangled-spec "0.3.6"]
[navis/untangled-datomic "0.4.9" :exclusions [com.datomic/datomic-free org.clojure/tools.cli]]]
Expand Down
2 changes: 1 addition & 1 deletion recipes/server-query-security/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[com.cemerick/piggieback "0.2.1"]
[org.clojure/tools.nrepl "0.2.12"]
[juxt/dirwatch "0.2.3"]
[navis/untangled-client "0.5.0-SNAPSHOT" :exclusions [cljsjs/react org.omcljs/om]]
[navis/untangled-client "0.5.0" :exclusions [cljsjs/react org.omcljs/om]]
[navis/untangled-server "0.4.8"]
[navis/untangled-spec "0.3.6"]
[navis/untangled-datomic "0.4.9" :exclusions [com.datomic/datomic-free org.clojure/tools.cli]]]
Expand Down
4 changes: 2 additions & 2 deletions recipes/server-query-security/src/client/app/ui.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
(dom/div #js {:key react-key}
(when server-error
(dom/p nil (pr-str "SERVER ERROR: " server-error)))
(dom/button #js {:onClick #(df/load-data this [{:person (om/get-query Person)}])} "Query for person with credit card")
(dom/button #js {:onClick #(df/load-data this [{:person (om/get-query Person)}] :without #{:cc-number})} "Query for person WITHOUT credit card")
(dom/button #js {:onClick #(df/load-data this [{:person (om/get-query Person)}] :refresh [:person])} "Query for person with credit card")
(dom/button #js {:onClick #(df/load-data this [{:person (om/get-query Person)}] :refresh [:person] :without #{:cc-number})} "Query for person WITHOUT credit card")
(df/lazily-loaded ui-person person)))))
2 changes: 1 addition & 1 deletion recipes/tabbed-interface/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[com.cemerick/piggieback "0.2.1"]
[org.clojure/tools.nrepl "0.2.12"]
[juxt/dirwatch "0.2.3"]
[navis/untangled-client "0.5.0-SNAPSHOT" :exclusions [cljsjs/react org.omcljs/om]]
[navis/untangled-client "0.5.0" :exclusions [cljsjs/react org.omcljs/om]]
[navis/untangled-server "0.4.8"]
[navis/untangled-spec "0.3.6"]
[navis/untangled-datomic "0.4.9" :exclusions [com.datomic/datomic-free org.clojure/tools.cli]]]
Expand Down
2 changes: 1 addition & 1 deletion recipes/websockets/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[com.cemerick/piggieback "0.2.1"]
[org.clojure/tools.nrepl "0.2.12"]
[juxt/dirwatch "0.2.3"]
[navis/untangled-client "0.5.0-SNAPSHOT" :exclusions [cljsjs/react org.omcljs/om]]
[navis/untangled-client "0.5.0" :exclusions [cljsjs/react org.omcljs/om]]
[navis/untangled-server "0.4.8"]
[navis/untangled-spec "0.3.6"]
[navis/untangled-websockets "0.1.0"]]
Expand Down
10 changes: 6 additions & 4 deletions recipes/websockets/src/client/app/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
[untangled.i18n :refer-macros [tr trf]]
[untangled.client.core :as uc]
[untangled.client.data-fetch :as df]
[untangled.websockets.networking :as wn]))
[untangled.websockets.networking :as wn]
[app.ui :as ui]))

(def initial-state {:ui/react-key "abc"
:current-user {}
(def initial-state {:ui/react-key "abc"
:current-user {}
:current-channel {}})

(defonce app (atom (uc/new-untangled-client
:networking (wn/make-channel-client "/chsk" :global-error-callback (constantly nil))
:initial-state initial-state
:started-callback (fn [{:keys [reconciler]}]
))))
(df/load-data reconciler [{:app/channels (om/get-query ui/Channel)}] :refresh [:app/channels])
(df/load-data reconciler [{:app/users (om/get-query ui/User)}]) :refresh [:app/users]))))
13 changes: 7 additions & 6 deletions recipes/websockets/src/client/app/push_receive.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
[om.next :as om]
[untangled.client.core :refer [refresh]]
[untangled.client.data-fetch :as df]
[untangled.websockets.networking :as n]))
[untangled.websockets.networking :as n]
[untangled.dom :as udom]))

(defmethod n/push-received :user/left [{:keys [reconciler] :as app} {:keys [msg]}]
(let [state (om/app-state reconciler)
channel-ident (get @state :current-channel)
user-ident [:user/by-id (:db/id msg)]]
(swap! state update :user/by-id dissoc (:db/id msg))
(swap! state update :app/users
(fn [users] (into [] (remove #(= user-ident %)) users)))
(fn [users] (into [] (remove #(= user-ident %)) users)))
(swap! state update-in (conj channel-ident :channel/users)
(fn [users] (into [] (remove #(= user-ident %)) users)))
(refresh app)))
(fn [users] (into [] (remove #(= user-ident %)) users)))
{:refresh [:app/users]}))

(defmethod n/push-received :user/new [{:keys [reconciler] :as app} {:keys [msg]}]
(let [state (om/app-state reconciler)
Expand All @@ -23,12 +24,12 @@
(swap! state assoc-in user-ident msg)
(swap! state update :app/users (fnil conj []) user-ident)
(swap! state update-in (conj channel-ident :channel/users) (fnil conj []) user-ident)
(refresh app)))
{:refresh [:app/users]}))

(defmethod n/push-received :message/new [{:keys [reconciler] :as app} {:keys [msg]}]
(let [state (om/app-state reconciler)
channel-ident (get @state :current-channel)
message-ident [:message/by-id (:db/id msg)]]
(swap! state assoc-in message-ident msg)
(swap! state update-in (conj channel-ident :channel/messages) (fnil conj []) message-ident)
(refresh app)))
{:refresh [:channel/messages]}))
4 changes: 1 addition & 3 deletions recipes/websockets/src/client/app/ui.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@
(initLocalState [this]
{:new-user ""})

(componentWillMount [this]
(df/load-data this [{:app/channels (om/get-query Channel)}])
(df/load-data this [{:app/users (om/get-query User)}]))


(render [this]
(let [{:keys [ui/react-key data app/channels app/users current-user current-channel]
Expand Down

0 comments on commit 6a0fbcf

Please sign in to comment.