Skip to content

Commit ce6d213

Browse files
rayliverifiedclaude
andcommitted
Lists can load the documents their reference fields point to
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 2e18a4d commit ce6d213

5 files changed

Lines changed: 42 additions & 13 deletions

File tree

‎lib/src/api/mixins.dart‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,6 +1395,12 @@ mixin QueryableMixin {
13951395
@JsonKey(defaultValue: QueryPaging.scroll)
13961396
QueryPaging paging = QueryPaging.scroll;
13971397

1398+
/// Reference fields whose documents load with the results: each result's
1399+
/// field then holds the referenced document (with its `id`), e.g.
1400+
/// `${item.author.name}`. The collection comes from the schema.
1401+
@JsonKey(defaultValue: [])
1402+
List<String> loadRelated = [];
1403+
13981404
/// Whether the query operation is going to be restrictive.
13991405
/// This pertains to Firestore's indexing rules.
14001406
bool get restrictedIndexing => useCloudDatabase;

‎lib/src/api/models/action/load_from_cloud_storage_action.g.dart‎

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎lib/src/api/nodes/grid_view_node.g.dart‎

Lines changed: 13 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎lib/src/api/nodes/list_view_node.g.dart‎

Lines changed: 13 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎test/query_status_states_test.dart‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ void main() {
5858
);
5959
expect(list.toJson().containsKey('paging'), isFalse);
6060
list.paging = QueryPaging.button;
61+
list.loadRelated = ['author'];
6162
final ListViewNode listBack = ListViewNode.fromJson(
6263
jsonDecode(jsonEncode(list.toJson())) as Map,
6364
);
6465
expect(listBack.paging, QueryPaging.button);
66+
expect(listBack.loadRelated, ['author']);
6567
});
6668
}

0 commit comments

Comments
 (0)