Skip to content

Commit

Permalink
Properly subscribe to player sheet IDs in the Campaign UI
Browse files Browse the repository at this point in the history
Refs #69
  • Loading branch information
dhleong committed Feb 11, 2019
1 parent c3190b1 commit 0cd6670
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions src/cljs/wish/subs.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -716,12 +716,24 @@
:<- [:active-sheet-id]
:<- [:active-sheet-source-ids]
:<- [:my-sheets]
(fn [[sheet-id source-ids my-sheets] _]
; NOTE: currently, we're only interested in changes
; to sheets we *don't* own.
; We could later listen to changes in the sources for
; a sheet we own, in which case we wouldn't be interested
; in sheet-id
(when (and sheet-id
(not (contains? my-sheets sheet-id)))
(into #{sheet-id} source-ids))))
:<- [:meta/players]
(fn [[sheet-id source-ids my-sheets campaign-players] _]
(cond
; in campaign mode we're interested in all the player sheets, and
; all of our sources. In the future, we might want to get all the
; sources of all the player sheets. We could potentially also
; subscribe to the campaign ID for real-time communication from
; players
campaign-players
(into campaign-players
source-ids)

; NOTE: currently, we're only interested in changes to sheets we
; *don't* own.
; We could later listen to changes in the sources for a sheet we
; own, in which case we wouldn't be interested in sheet-id
(and sheet-id
(not (contains? my-sheets sheet-id)))
(into #{sheet-id} source-ids)

:else nil)))

0 comments on commit 0cd6670

Please sign in to comment.