Prevent the binding from calling adapter subscribe/unscribe when
@keypath is undefined.
Showing
1 changed file
with
2 additions
and
2 deletions
... | @@ -96,7 +96,7 @@ class Rivets.Binding | ... | @@ -96,7 +96,7 @@ class Rivets.Binding |
96 | if @options.bypass | 96 | if @options.bypass |
97 | @sync() | 97 | @sync() |
98 | else | 98 | else |
99 | Rivets.config.adapter.subscribe @model, @keypath, @sync | 99 | Rivets.config.adapter.subscribe @model, @keypath, @sync if @keypath |
100 | @sync() if Rivets.config.preloadData | 100 | @sync() if Rivets.config.preloadData |
101 | 101 | ||
102 | loopDeps @, (model, keypath) => Rivets.config.adapter.subscribe model, keypath, @sync | 102 | loopDeps @, (model, keypath) => Rivets.config.adapter.subscribe model, keypath, @sync |
... | @@ -106,7 +106,7 @@ class Rivets.Binding | ... | @@ -106,7 +106,7 @@ class Rivets.Binding |
106 | @binder.unbind?.call @, @el | 106 | @binder.unbind?.call @, @el |
107 | 107 | ||
108 | unless @options.bypass | 108 | unless @options.bypass |
109 | Rivets.config.adapter.unsubscribe @model, @keypath, @sync | 109 | Rivets.config.adapter.unsubscribe @model, @keypath, @sync if @keypath |
110 | 110 | ||
111 | loopDeps @, (model, keypath) => Rivets.config.adapter.unsubscribe model, keypath, @sync | 111 | loopDeps @, (model, keypath) => Rivets.config.adapter.unsubscribe model, keypath, @sync |
112 | 112 | ... | ... |
-
Please register or sign in to post a comment