Possible bug with Observable.filter

– fuse v0.25
– OS X

version of fuse does not appear to be an issue since it had occurred with 0.24 too.
I am testing on an iPhone 6s but I do not believe that is the issue, I cannot test on an android do to fuse-contacts causing a missing permissions error during compile time.

I’ve also included the full file to which you can see has filters being used else where but working fine.

full function

function newChat(){
    // TODO fetch for new chat id then add new chat to client db
    // if(contactsListValid.length > 0){
        console.log("open new chat");
        console.log("before filter " + JSON.stringify(contactsListValid));
        console.log("filter " + JSON.stringify(contactsListValid
                                                .filter
                                                (function (contact) { 
                                                    return contact.selected === true;
                                                })));
        var members = contactsListValid.filter(function (contact) { return contact.selected === true;});
                       
        console.log("members " + JSON.stringify(members));
        console.log("members length " + members.length);

        if(members.length > 0) {
            //TODO replace members with just a chat
            router.push("home", {}, "chat", {members: members});
        }
    // } else {
    //     console.log("empty list");
    // }
};```

but specifically 

console.log("before filter " + JSON.stringify(contactsListValid));
console.log("filter " + JSON.stringify(contactsListValid
.filter
(function (contact) {
return contact.selected === true;
})));

or this slightly different variant

console.log("before filter " + JSON.stringify(contactsListValid));
console.log("filter " + JSON.stringify(contactsListValid
.filter
(function (contact) {
return contact.selected.value === true;
})));

have the same results which you'll find below.

before filter {"_subscribers":[null],"_isLeaf":true,"_values":[{“firstName”:“Amo”,“lastName”:“Younis”,“organization”:null,“email”:[],“phone”:“0857168682”,“fullName”:“Younis Amo”,“selected”:{"_subscribers":[null],"_isLeaf":true,"_values":[true]}}]}

filter {"_subscribers":[],"_isLeaf":false,"_values":[]}

Would not let me upload the file but here is the full file

var Observable = require('FuseJS/Observable');
var contacts = require('Contacts');

contacts.authorize().then(function (status) {
    console.log(status);
    if (status === 'AuthorizationAuthorized') {
    	console.log("AuthorizationAuthorized")
        // console.log(JSON.stringify(contacts.getAll()));
        // contactsList = JSON.stringify(contacts.getAll());
    } else if (status === 'AuthorizationDenied'){
    	console.log("AuthorizationDenied");
    } else if (status === 'AuthorizationRestricted'){
    	console.log("AuthorizationRestricted");
    } else {
    	console.log("unknown");
    }
});

var contactsList = Observable(
                    contacts.getAll()
                    .filter(function(contact) {
                        return contact.phone.length > 0;
                    })
                    .map(function(contact) {
                        contact.firstName = contact.firstName;
                        contact.lastName  = contact.lastName;
                        contact.fullName = contact.lastName + " " + contact.firstName;
                        // TODO do the replace function
                        contact.phone = contact.phone[0].phone.replace(/\s/g, "").replace(/"-"/g, "").replace(/"\("/g, "");
                        contact.selected = Observable(false);
                        return contact;
                    })
                    .sort(function(a,b){
                        if(a.lastName !== null && b.lastName !== null){
                            return a.lastName.localeCompare(b.lastName);
                        } else if(a.lastName === null || b.lastName === null){
                            if(a.lastName !== null){
                                return a.lastName.localeCompare(b.firstName);
                            } else if (b.lastName !== null){
                                return a.firstName.localeCompare(b.lastName);
                            }
                        } else if (a.firstName !== null && b.firstName !== null){
                            return a.firstName.localeCompare(b.firstName);
                        } else {
                            return a.phone.localeCompare(b.phone);
                        } 
                    }));

var contactsListValid = Observable();
function onload() {
    console.log("contacts numbers only" + contactsList.value.map(function(contact) {return contact.phone;}));
    fetch("http://192.168.192.116:3000/queryusers", {
        method: 'POST',
        headers: { "Content-type": "application/json"},
        body: JSON.stringify(contactsList.value.map(function(contact) {return contact.phone;})) 
    }).then(function (response){
        // console.log("response " + JSON.stringify(response));
        return response.json();
    }).then(function(responseObject) {
        console.log("response " + JSON.stringify(responseObject));
        contactsList.value.filter(function(contact){
            // console.log(JSON.stringify(contact));
            if(responseObject.indexOf(contact.phone) > -1) {
                console.log(JSON.stringify(contact));
                if(!contactsListValid.contains(contact)){
                    contactsListValid.add(contact);
                }
            } 
        });
        console.log("lenght " + JSON.stringify(contactsListValid.length));
    }).catch(function(err){
        debug.log("error: " + err.message);
    });
    console.log("after fetch " + JSON.stringify(contactsListValid));
};

function toggleSelect(args){
    args.data.selected.value = !args.data.selected.value;
    console.log("toggled data " + JSON.stringify(args.data) + JSON.stringify(args.data.selected.value));
};

function newChat(){
    // TODO fetch for new chat id then add new chat to client db
    // if(contactsListValid.length > 0){
        console.log("open new chat");
        console.log("before filter " + JSON.stringify(contactsListValid));
        console.log("filter " + JSON.stringify(contactsListValid
                                                .filter
                                                (function (contact) { 
                                                    return contact.selected === true;
                                                })));
        var members = contactsListValid.filter(function (contact) { return contact.selected === true;});
                       
        console.log("members " + JSON.stringify(members));
        console.log("members length " + members.length);

        if(members.length > 0) {
            //TODO replace members with just a chat
            router.push("home", {}, "chat", {members: members});
        }
    // } else {
    //     console.log("empty list");
    // }
};

module.exports = {
	contacts: contactsListValid,
    toggleSelect: toggleSelect,
    goBack: function(){ router.goBack();},
    newChat: newChat,
    onload: onload
};```

Turns out it was no bug but merely me using the code in the wrong way