Skip to content

Infinite loop in circular computeds #1943

@juuxstar

Description

@juuxstar

It looks like computeds are prone to a circular dirtying loop as demonstrated by:

ko.options.deferUpdates = true;
a = ko.observable();
b = ko.computed({ read : function() { a(); return d(); }, deferEvaluation : true });
d = ko.computed({ read : function() { a(); return b(); }, deferEvaluation : true });
d();
a('something');

This will crap out with a "Maximum call stack size exceeded". Looks like it's not the evaluation of them but the scheduling for re-evaluation,

Tested with KO 3.4.

https://jsfiddle.net/ye0b2p0w/10/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions