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

SubsManager between two subscriptions #81

Open
RemyLespagnol opened this issue Jul 24, 2016 · 1 comment
Open

SubsManager between two subscriptions #81

RemyLespagnol opened this issue Jul 24, 2016 · 1 comment

Comments

@RemyLespagnol
Copy link

RemyLespagnol commented Jul 24, 2016

Hi,

I use SubsManager to cache subscription on the client.
But something went wrong.

I have an Artworks collection with two publish methods :

Meteor.publish('artwork', function (artwork_pubsId) {
        return Artworks.find(artwork_pubsId);
});

Meteor.publish('artworks_preview', function () {
    return Artworks.find({}, {fields: {description: 0}, limit : 2});
});

I have two components with React with container :

const ArtworkSubs = new SubsManager();

export const composer = ({context}, onData) => {
  const {Meteor, Collections} = context();

  if (UserSubs.subscribe('user_home_preview').ready() && ArtworkSubs.subscribe('artworks_preview').ready()) {
    const users = Meteor.users.find().fetch();
    const artworks = Collections.Artworks.find().fetch();
    onData(null, {users : users, artworks : artworks});
  }
//...

And

const ArtworkSubs = new SubsManager();

export const composer = ({context,id}, onData) => {
  const {Meteor, Collections, FlowRouter} = context();

    if(ArtworkSubs.subscribe('artwork',id).ready()){
       const artwork = Collections.Artworks.find({}).fetch();
//...

First component hide description field of the artworks.
So when I go to an artwork page with the first publish, I don't have the description field...
If I go directly to the artwork page, I have this description, and when I go to the home page all artworks have this description field.

How can I do to have the good information in the good place ?
I need SubsManager to keep data in client cached to go back an auto scroll to the previous position...

I post to the meteor forum, but I don't have any solution for the moment.
https://forums.meteor.com/t/subsmanager-between-two-subscriptions/26773

@arunoda can you help me ?

Thanks.

@RemyLespagnol
Copy link
Author

Any suggestions ?

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

1 participant