You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry, I misunderstood the code. The inverted flag seems correct.
The question is actually how can I eventually get rid of the observableArray subscriptions made by a ko.validation.group using live: true in config when I'm done with the validation group?
Thinking perhaps add/wrap (depending on observable flag) dispose on the result returned from ko.validation.group to include a cleanUpSubscriptions?
Old post
In traverseGraph there is this piece of code: if (context.options.live && utils.isObservableArray(obj)) { context.subscriptions.push(obj.subscribe(function () { context.graphMonitor.valueHasMutated(); })); }
That is the only place I can find that subscriptions array is being added to.
But when time comes for disposal the code looks like this: if (!context.options.live) { cleanUpSubscriptions(context); }
Should the check against live flag really be inverted?
It will cause dispose to skip cleaning up subscriptions for the cases where there might actually be some subscriptions according to my test.
Sorry, I misunderstood the code. The inverted flag seems correct.
The question is actually how can I eventually get rid of the observableArray subscriptions made by a ko.validation.group using live: true in config when I'm done with the validation group?
Thinking perhaps add/wrap (depending on observable flag) dispose on the result returned from ko.validation.group to include a cleanUpSubscriptions?
Old post
In traverseGraph there is this piece of code:
if (context.options.live && utils.isObservableArray(obj)) { context.subscriptions.push(obj.subscribe(function () { context.graphMonitor.valueHasMutated(); })); }
That is the only place I can find that subscriptions array is being added to.
But when time comes for disposal the code looks like this:
if (!context.options.live) { cleanUpSubscriptions(context); }
Should the check against live flag really be inverted?
It will cause dispose to skip cleaning up subscriptions for the cases where there might actually be some subscriptions according to my test.
Example code
https://github.com/SimmeNilsson/KnockoutValidationDisposeFix
Added console.log for these parts in the code.
knockout.validation.fixed.js has the inverting removed.
The text was updated successfully, but these errors were encountered: