Skip to content

Commit

Permalink
fix(torii-grpc): member clause should never error out if no entities
Browse files Browse the repository at this point in the history
  • Loading branch information
Larkooo committed Sep 12, 2024
1 parent bf4ea9b commit eca7f15
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion crates/torii/grpc/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,14 @@ impl DojoWorld {
"#,
compute_selector_from_names(namespace, model)
);
let (models_str,): (String,) = sqlx::query_as(&models_query).fetch_one(&self.pool).await?;

let models_result: Option<(String,)> = sqlx::query_as(&models_query).fetch_optional(&self.pool).await?;

Check warning on line 525 in crates/torii/grpc/src/server/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/torii/grpc/src/server/mod.rs#L525

Added line #L525 was not covered by tests
// we return an empty array of entities if the table is empty
if models_result.is_none() {
return Ok((Vec::new(), 0));
}

let (models_str,) = models_result.unwrap();

Check warning on line 531 in crates/torii/grpc/src/server/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/torii/grpc/src/server/mod.rs#L527-L531

Added lines #L527 - L531 were not covered by tests

let model_ids = models_str
.split(',')
Expand Down

0 comments on commit eca7f15

Please sign in to comment.