meteor-space / tracker-mobx-autorun

Integrate Meteor reactive data with MobX for simple yet highly optimized state management
MIT License
32 stars 8 forks source link

Load more button #9

Closed ykshev closed 8 years ago

ykshev commented 8 years ago

Question about implementing load more button and autorun:

var sub = new SubsManager();
export default () => {
  store.isLoading = true;
  const handle = sub.subscribe( 'Projects.Private', store.projectsCount );
  if (handle.ready()) {
    store.projects.replace(Projects.find({}).fetch());
    store.isLoading = false
  }
};

Then in a react component I press "Load more" button with onClick event and increase store.projectsCount on 10 for example and it seems that subscription runs again and re-render entire project list(And more important that it scrolls you browser window to the top and break user experience).

Any suggestions how to update subscription without reloading entire list?

ykshev commented 8 years ago

My fault, problem was in checking store.isLoading in my container component, after I've deleted it everything works well.