[SOLVED] I dont know why data doesnt update


#1

[CLOSED] IT WAS A PROBLEM WITH MATERIALIZECSS FRAMEWORK

Solution: use a similar helper after {{#each}} , it is not perfect but it works.

iniSelect: function(){
        var procesorPower = Session.get('procesorPower');
        
        Meteor.setTimeout(function(){
            $('select').material_select()
        }, 50);
        
    }

I set the session var

Template.configurator.onCreated(function () {
    Session.set({
         procesorPower: ''
    });
});

I set the session var with the selected value  
Template.configurator.events({
    
    'change select.procesorPower': function (event,template) {
         Session.set('procesorPower',$('select.procesorPower').val() );
    }
    
}); 

At last, this helper reruns


Template.configurator.helpers({
    
     getProcesor: function () {
        
         var querySelector = {type: 'procesadores', stock: {$gt: 0} };
         var queryFields = {fields: { desc:0 , negativeUpvoters:0 , positiveUpvoters:0} };
                
         var procesorPower = Session.get('procesorPower');
         
         if ( procesorPower !== '' ){
            querySelector.power = procesorPower;
         }
         
         console.log(querySelector);
         
         return Products.find(querySelector,queryFields) ;
     },
})

And the data is updated
{{#each getProcesor}} {{/each}}

But this doesnt work.
In other hand, if I set the ‘querySelector’ var by hand, it works perfectly.
The console.log() before returning the data also works fine.

[EDIT] It’s returning the right data but it seems the {{each}} doesnt work

What is the problem ?
I have read it many times but I dont find the problem.
Thank you for reading.