Comments (4)
This is a bit of a critical issue for me, so any help will be greatly appreciated. Thanks!
from apollo.
OK, I think it is explained here:
https://github.com/cult-of-coders/apollo-live-server
The current limitation is that the reactive events dispatched by this publication are only at Notification level in the database, but what happens when we want to also send down the pipe relational info, such as, Task linked to Notification by taskId, how can we handle this ?
from apollo.
OK, I solved it by enhancing the resolver for the subscription:
Subscription: {
groups: {
resolve: (payload, args, {db}) => {
if (payload.event === Event.ADDED) {
// do a direct grapher query to get the linked data
let linkedDoc = db.groups.createQuery({
$filters: {
_id: payload.doc._id
},
_id: 1,
name: 1,
description: 1,
members: {
_id: 1,
name: 1,
company: 1
},
admins: {
_id: 1,
name: 1,
company: 1
}
}).fetch();
if (linkedDoc && linkedDoc.length) {
// there should be only one record since we filtered on the added doc
return ({
doc: linkedDoc[0],
event: payload.event
});
}
// something went wrong, send back original payload
return (payload);
}
return (payload);
},
subscribe(_, args, context) {
console.log("Calling groups subscription; user = " + context.userId);
// sanity checks
if (!context.userId) {
throw new Meteor.Error("authorization-error", "Action not authorized");
}
const observer = context.db.groups.find({
memberIds: context.userId
});
return asyncIterator(observer);
}
}
},
...
It would be nice to figure out what the associated query was in the initial ReactiveQuery subscription, so that we know exactly what date to send back.
But this works for now...
from apollo.
@ujwal-setlur indeed, this is currently a limitation, and even if we do this, grapher could export a functionality that does this essentially, however it's very problematic with links
in which storage is on the other side, because you have to watch those documents too! So it kinda sucks, and we have to rely on something like publish-composite
but for Apollo.
This would be a good feature request.
from apollo.
Related Issues (20)
- Authentication Directives HOT 1
- [Question] Fields resolved by external API HOT 6
- me query returns null HOT 6
- apollo db not work HOT 2
- [Question] How to expose links' metadata in schema HOT 1
- Shouldn't require resolvers for links. HOT 2
- Query lock-down on production
- Decouple Apollo Client to NPM
- Could I use this package for `Meteor + Vue`? HOT 2
- Get `userId = null`? HOT 1
- See what we can learn from here.
- Get the loader from cultofcoders:apollo
- Deep filtering
- `userId` is `undefined` in `matb33:collection-hooks` HOT 1
- Support Apollo Client 3.0
- test 2 p
- test 1 p
- test 1
- Project Management
- \ttest se tset
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apollo.