Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't try updated non-writeable observable

  • Loading branch information...
commit ae5c298b6deea9edb0b9e7f5733651dc3a8c5dad 1 parent f44e464
@halter73 halter73 authored
View
17 samples/Microsoft.AspNet.SignalR.Hosting.AspNet.Samples/Scripts/jquery.signalR.knockout.js
@@ -24,7 +24,10 @@
},
koUpdate: function (x, newValue) {
- return x(newValue);
+ // TODO: We shouldn't have to make this check. Look into why we do.
+ if (window.ko.isWriteableObservable(x)) {
+ return x(newValue);
+ }
},
identity: function (x) {
@@ -240,6 +243,9 @@
modelPeek = merge(modelPeek, diff.value, diffTag);
}
+ // Ideally I will only update if diff._updated, but I'm reverting this
+ // change since I don't notify the merge function to rebuild after
+ // "GetKnockoutState" which doesn't include _updated.
if (builder.update) {
builder.update(model, modelPeek);
} else {
@@ -287,6 +293,15 @@
ko = window.ko,
savedCreateHubProxy = $.hubConnection.prototype.createHubProxy,
defaultBuilders = [{
+ name: "koReadOnlyObservable",
+ diffable: true,
+ match: function (object) {
+ return ko.isObservable(object) && !ko.isWriteableObservable(object);
+ },
+ peek: utils.koPeek,
+ create: utils.identity,
+ update: utils.identity
+ }, {
name: "koObservableArray",
diffable: true,
match: function (object) {
View
9 src/Microsoft.AspNet.SignalR.Knockout.JS/jquery.signalR.knockout.core.js
@@ -11,6 +11,15 @@
ko = window.ko,
savedCreateHubProxy = $.hubConnection.prototype.createHubProxy,
defaultBuilders = [{
+ name: "koReadOnlyObservable",
+ diffable: true,
+ match: function (object) {
+ return ko.isObservable(object) && !ko.isWriteableObservable(object);
+ },
+ peek: utils.koPeek,
+ create: utils.identity,
+ update: utils.identity
+ }, {
name: "koObservableArray",
diffable: true,
match: function (object) {
View
3  src/Microsoft.AspNet.SignalR.Knockout.JS/jquery.signalR.knockout.diff.js
@@ -158,6 +158,9 @@
modelPeek = merge(modelPeek, diff.value, diffTag);
}
+ // Ideally I will only update if diff._updated, but I'm reverting this
+ // change since I don't notify the merge function to rebuild after
+ // "GetKnockoutState" which doesn't include _updated.
if (builder.update) {
builder.update(model, modelPeek);
} else {
View
5 src/Microsoft.AspNet.SignalR.Knockout.JS/jquery.signalR.knockout.utils.js
@@ -23,7 +23,10 @@
},
koUpdate: function (x, newValue) {
- return x(newValue);
+ // TODO: We shouldn't have to make this check. Look into why we do.
+ if (window.ko.isWriteableObservable(x)) {
+ return x(newValue);
+ }
},
identity: function (x) {
Please sign in to comment.
Something went wrong with that request. Please try again.