Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

this.subscriptionsReady() Not Updating #7

Open
ralphievolt opened this issue Apr 19, 2016 · 7 comments
Open

this.subscriptionsReady() Not Updating #7

ralphievolt opened this issue Apr 19, 2016 · 7 comments
Assignees

Comments

@ralphievolt
Copy link

this.autorun(() => { this.setState({ ready: this.subscriptionsReady(),

this.state.ready once change to false does not update anymore even if I purposely delayed the publication.

@timbrandin
Copy link
Member

Oh, I have to create a test for this, sounds not so great. Thx for noticing!

@dnish
Copy link

dnish commented Apr 27, 2016

Yep, having the same problem. If my subscriptions change, this.subscriptionsReady() goes not to true anymore.

@timbrandin timbrandin self-assigned this May 9, 2016
@ralphievolt
Copy link
Author

@timbrandin any update on this?

@timbrandin
Copy link
Member

@ralphievolt yeah, this has to do with that we're saving the subscriptions with a jsonified object of the name and arguments, this causes it to save a new one for each time it is updated. @Elviron has started looking at this, https://github.com/Elviron/tracker-component/commit/2ec758a1badfcb05ac412f608c8db0f988ddded3

We should probably just store per name, I did this before though, and I can't remember why I changed it to store subscriptions with all the arguments. PR's are welcome.

@Falieson
Copy link

I'm looking forward to a solve on this as well! For those lookin for a bit more detailed code causing this issue.
I have an instance with mulitple task lists (variation of the popular todo tutorials). When the setVisibility toggler for one list is changed, showCompleted changes between true and false. This updates the subscription for this list's taskItems but when changing this.subscribe's filters in Meteor's Tracker update this.subscriptionsReady() returns false instead of true causing dispatch(fetchTaskItems(listId)) to never update the store.

    this.autorun(()=> {
      const {
        listId,
        showCompleted,
        dispatch
      } = this.props;

      const showAll = showCompleted || showCompleted===undefined? true:false;
      const filters = showAll? 'SHOW_ALL':'SHOW_ACTIVE';

      this.subscribe('taskItemsForList', listId, filters);

     // #FIXME# changing the subscription caused subscriptionsReady() to return false;
     if(this.subscriptionsReady()){
        dispatch(fetchTaskItems(listId));
      }
      else {
        dispatch(taskItemsSubscriptionPending(listId));
      }
    });

@focused
Copy link

focused commented Jul 27, 2016

Any workarounds? I don't understand how to fix this(

@jasonnathan
Copy link

Any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants