matteodem / meteor-easy-search

Easy-to-use search for Meteor with Blaze Components
MIT License
438 stars 68 forks source link

Are Components Reactive? #558

Closed zyonnetworks closed 7 years ago

zyonnetworks commented 7 years ago

The data results isn't updating when using a reactive helper. Should this update the results reactively OR do i need to add a config option OR is this not supported?

/index.js

Template.templateName.onRendered(function() {
    this.autorun(function() {
            reactiveIndex.set(someIndex);
    }
})
Template.templateName.helpers({
currentIndex() {
    return reactiveIndex.get();
}
});

/index.html

{{#EasySearch.Each index=currentIndex}}
    <li>{{this}}</lI>
{{/EasySearch.Each}}
zyonnetworks commented 7 years ago

i actually got this to work by making some really minor updates to BaseComponent and getCursor()

matteodem commented 7 years ago

What did you patch in there?

zyonnetworks commented 7 years ago

/packages/easysearch:components/lib/base.js

onCreated() {

        this.autorun(function() { // added autorun
            let index = this.getData().index,
                indexes = [index];
            ...
        } // added autorun
}

/packages/easysearch:components/lib/component-methods.js line 23

options = dict.get('searchOptions') || {}, //added || {}
choncj commented 7 years ago

Is there a way to have the pagination component and pagination page reactive? Removing Items from the Collection wont update the page correctly. Adding new items to the Collection wont update the Pagination count.

Any help would be really great!

zeichenflache 1

zeichenflache 1 kopie

matteodem commented 7 years ago

Could you please create a new issue with reproduction steps? A reproduction repository will make it even easier to find the bug and fix it.

choncj commented 7 years ago

@matteodem Thank you for the fast reply. I created a new issue #610