Skip to content

Infinite dependency chains #17

@ianopolous

Description

@ianopolous

Thanks for the great library! I'm trying to debug an issue where I end up with 2 async computed properties cyclically triggering each other. As far as I can see it should be only one way. I just wanted to check that it is okay to have one async property depend on another?

The two properties I have are "files" and "currentDir". I expect "files" to depend on "currentDir", but not the other way around. Am I doing something wrong here? The full file is here (context is an object from an external library which returns Promise like objects with "thenApply" methods.

`
currentDir: function() {
var context = this.getContext();
if (context == null)
return Promise.resolve(null);
var x = this.forceUpdate;
var path = this.getPath();
return new Promise(function(resolve, reject) {
context.getByPath(path).thenApply(function(file){
resolve(file.get())
});
});
},

files: function() {
        var current = this.currentDir;
    if (current == null)
	return Promise.resolve([]);
    var that = this;
    return new Promise(function(resolve, reject) {
	current.getChildren(that.getContext()).thenApply(function(children){
	    var arr = children.toArray();
	    that.showSpinner = false;
	    resolve(arr.filter(function(f){
		return !f.getFileProperties().isHidden;
	    }));
	});
    });
    },`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions