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

Problems displaying requests in React #22

Closed
matwii opened this issue Oct 20, 2016 · 5 comments
Closed

Problems displaying requests in React #22

matwii opened this issue Oct 20, 2016 · 5 comments

Comments

@matwii
Copy link

matwii commented Oct 20, 2016

Currently im just testing this package with sending a friendrequest like this:
askFriend(email){ var user = Accounts.findUserByEmail(email); user.requestFriendship(); }

and displaying the number of requests like this:
console.log('this.user: ', Meteor.user().numRequests());
But I am just getting up 0 whatever I do.

@StorytellerCZ
Copy link
Contributor

You need to properly subscribe to all the data. In short you are missing certain data pieces on your client.

Here is a sample of how you should publish: https://github.com/StorytellerCZ/Socialize-starter/blob/master/server/publications/friendships.js#L55

Note that I'm using publish composite which is a third-party package to publish all the related documents together.

@matwii
Copy link
Author

matwii commented Oct 20, 2016

Okay thanks, but where in your code are you subscribing on this collection in the client? I'm having a bit trouble understanding it cause im using Tracker.React.

@StorytellerCZ
Copy link
Contributor

I'm using Mantra, so I subscribe in container for the react component.

https://github.com/StorytellerCZ/Socialize-starter/blob/master/client/modules/users/containers/dashboard_friends.js

@matwii matwii closed this as completed Oct 24, 2016
@matwii
Copy link
Author

matwii commented Oct 25, 2016

Okay thanks! One last question, where are you sending the props that you
are using in your FriendRequest component from ?

2016-10-20 22:13 GMT+02:00 Jan Dvorak notifications@github.com:

I'm using Mantra, so I subscribe in container for the react component.

https://github.com/StorytellerCZ/Socialize-starter/blob/master/client/
modules/users/containers/dashboard_friends.js


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#22 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIG6dGBjXI3b6SRlV31VmrBCobxlxP3bks5q18t3gaJpZM4Kb5f5
.

@StorytellerCZ
Copy link
Contributor

Not sure what you mean, I only have one prop, which is the list of requests which comes from container of the same name (go into the container file in that module to see them).

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

2 participants