Bugfix #1856 - ensure futures are evaluated in the course of Value::get. (#1867)

This commit is contained in:
Finn Bear 2023-04-25 15:58:50 -07:00 committed by GitHub
parent f04f575283
commit eeb46468aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -34,7 +34,14 @@ impl Value {
// No further embedded fields, so just return this
0 => Ok(Value::Future(v.clone())),
// Process the future and fetch the embedded field
_ => v.compute(ctx, opt, txn, None).await?.get(ctx, opt, txn, path).await,
_ => {
// Ensure the future is processed
let fut = &opt.futures(true);
// Get the future return value
let val = v.compute(ctx, fut, txn, None).await?;
// Fetch the embedded field
val.get(ctx, opt, txn, path).await
}
}
}
// Current path part is an object