-
-
Notifications
You must be signed in to change notification settings - Fork 434
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
make Federation + Dataloader work #431
Comments
I'll check this out tomorrow.😄 |
I added an example: async-graphql/tests/federation.rs Line 155 in 1e6ae23
|
@sunli829 I think you need to check the keys, otherwise your test passes despite dataloader malfunctioning: async fn load(&self, keys: &[ID]) -> Result<HashMap<ID, Self::Value>, Self::Error> {
assert_eq!(
vec![ID::from("1"), ID::from("2"), ID::from("3"), ID::from("4")],
keys
);
...
} I'm still learning async rust, but after some debugging it seems |
Using let representations: Vec<Any> = ctx.param_value("representations", None)?;
let res = join_all(
representations
.iter()
.map(|item| self.inner.find_entity(ctx, &item.0)),
)
.await
.into_iter()
.map(|item| {
item.unwrap()
.ok_or_else(|| ServerError::new("Entity not found.").at(ctx.item.pos))
.unwrap()
})
.collect();
return Ok(Some(Value::List(res)));
} But I guess there is a better way ... |
It is indeed better to use |
Released in |
🌹 |
When Apollo Gateway sends something like
dataloader inside
#[graphql(entity)]
is not working at the moment.I guess the relevant code is here, but I couldn't investigate no further..:
The text was updated successfully, but these errors were encountered: