Hi!
I’m using the great Tabular package. https://github.com/Meteor-Community-Packages/meteor-tabular.
I’m making use of the client-side selector
helper to Reactively change my table by having Server modify the query for my dataset.
I have multiple HTML input
s that act as filters and am populating a ReactiveDict with the values
. A search-button click event triggers the ReactiveDict
to get populated with an Object using .set
Initialization of ReactiveDict
Template.tbl.onCreated(function () {
const self = this;
self.filters = new ReactiveDict({});
});
Population of ReactiveDict
'click #search-button'(e, template) {
//clear to 'reset' fields in ReactiveDict that could've been cleared by User
template.filters.clear();
const searchableFields = getSearchableFields();
//Initialize standard JS Obj that ReactiveDict will then be set to
const filterObj = {};
//Loop through search fields on DOM and populate into Obj if they have a val
for (let field of searchableFields) {
const value = $(`#${field}-filter`).val();
if (value) {
filterObj[field] = new RegExp(escapeStringRegex(value.trim()), 'i');
}
}
if (Object.keys(filterObj).length) {
template.filters.set(filterObj);
}
},
Selector Helper
selector: () => {
const filters = Template.instance().filters.all();
const selector = { SOME_DEFAULT_OBJ, ...filters };
return selector;
},
I’m noticing the server doesn’t notice any changes from a ReactiveDict if all keys remain the same.
I’m testing this by logging in the serve-side’s changeSelector
md and verifying that my logging does not occur if just a value in selector has changed.
Is there a solution to this?
I.e. {foo:'foo'} to {foo:'bar'}
should reactively trigger the server to re-query but it does not. But {foo:'foo'} to {bar:'bar'}
would get triggered.
Is this an issue with how I’m using the ReactiveDict or is this on the Tabular side?
Thanks