🐛 [firebase_ui_firestore] FirestoreDataTable need polishing to only query the right amount of data
维护者通常 2 天内回复
@rrousselGit 已经在做这个了。
开始于 2023年10月3日。
评估
这个 Issue 还没有评估数据。
描述
Bug report
Describe the bug
After the code(bellow) the first item is more an discussion than a bub, but the point 2 and 3 seems to be bugs.
@override
Widget build(BuildContext context) {
return StreamBuilder(
stream: _query.snapshots(),
builder: (context, snapshot) {
return AggregateQueryBuilder(
query: _query.count(),
builder: (context, aggSsnapshot) {
return FirestoreQueryBuilder<Map<String, Object?>>(
query: _query,
builder: (context, snapshot, child) {
if (aggSsnapshot.hasData) {
source.setFromSnapshot(snapshot, aggSsnapshot.requireData);
} else {
source.setFromSnapshot(snapshot);
}
return AnimatedBuilder(
animation: source,
builder: (context, child) {
final actions = [
...?widget.actions,
if (widget.canDeleteItems &&
source._selectedRowIds.isNotEmpty)
IconButton(
icon: const Icon(Icons.delete),
onPressed: source.onDeleteSelectedItems,
),
];
return PaginatedDataTable(
source: source,
onSelectAll: selectionEnabled ? source.onSelectAll : null,
onPageChanged: widget.onPageChanged,
showCheckboxColumn: widget.showCheckboxColumn,
arrowHeadColor: widget.arrowHeadColor,
checkboxHorizontalMargin: widget.checkboxHorizontalMargin,
columnSpacing: widget.columnSpacing,
dataRowMaxHeight: widget.dataRowMaxHeight,
dataRowMinHeight: widget.dataRowMinHeight,
dragStartBehavior: widget.dragStartBehavior,
headingRowHeight: widget.headingRowHeight,
horizontalMargin: widget.horizontalMargin,
rowsPerPage: widget.rowsPerPage,
showFirstLastButtons: widget.showFirstLastButtons,
sortAscending: widget.sortAscending,
sortColumnIndex: widget.sortColumnIndex,
header: actions.isEmpty
? null
: (widget.header ?? const SizedBox()),
actions: actions.isEmpty ? null : actions,
columns: [
for (final head in widget.columnLabels.values)
DataColumn(label: head)
],
);
},
);
},
);
},
);
},
);
}
Couple os things:
-
Do we really want StreamBuilder at the first place?
Seems it only needed to make sure the AggregateQueryBuilder will return the right number of rows, if the data is changing on the query side....but this defeat the intent of limiting the data retrieved, we even make an extra query when we can use the docs.lenght to update the PaginatedDataTable bottom navigation information. -
I think the we need to pass to the FirestoreQueryBuilder to limit the snapshot to the number of rows we have in the page =>
pageSize: widget.rowsPerPage,otherwise if you allow the checkbox and select all items on the page (with let say 10 rows) you will get 20 item selected !!! -
With the addition of the _aggregateSnapshot I think the override of :
bool get isRowCountApproximate => _aggregateSnapshot?.count == null || (_previousSnapshot!.isFetching || _previousSnapshot!.hasMore);
maybe not right, because the intent of having AggregateQueryBuilder seems to have the exact number of rows, so the isRowCountApproximate can be always false. But we can argue the query can send more rows the next time tap on the next page...
- 主要语言
- Dart
- 星标
- 152
- 派生
- 142
- 平均合并
- 2 天 54 分钟
- 30 天内合并 PR
- 11
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
firebase/FirebaseUI-Flutter 的其他 Issue
-
auth blocked: customer response enhancement Keep Open
难度 3/5 1-2 天 新手友好度 35/100
firebase/FirebaseUI-Flutter#418 · 7 条评论 · 3 个 reaction ·
维护者通常 2 天内回复
-
auth Keep Open Needs Attention
难度 4/5 3-5 天 新手友好度 20/100
firebase/FirebaseUI-Flutter#351 · 3 条评论 · 1 个 reaction ·
维护者通常 2 天内回复
-
enhancement Keep Open storage
难度 4/5 3-5 天 新手友好度 38/100
firebase/FirebaseUI-Flutter#290 · 2 条评论 ·
维护者通常 2 天内回复
-
auth bug Keep Open Needs Attention
难度 4/5 3-5 天 新手友好度 25/100
firebase/FirebaseUI-Flutter#261 · 6 条评论 · 3 个 reaction ·
维护者通常 2 天内回复
-
auth blocked: customer response bug Keep Open
难度 4/5 3-5 天 新手友好度 35/100
firebase/FirebaseUI-Flutter#253 · 21 条评论 · 2 个 reaction ·
维护者通常 2 天内回复
查看 firebase/FirebaseUI-Flutter 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 80/100
rajput-hemant/calculator#199 ·
-
难度 2/5 1-3 小时 新手友好度 62/100
leancodepl/app-rating#35 ·
-
Mobile login: "Sign In" button is squashed to 16 px with its label cut while the keyboard is open未关闭ai-driven-qa bug claude
难度 2/5 1-3 小时 新手友好度 78/100
linagora/tmail-flutter#4976 ·
维护者通常 1 天内回复
-
P2 package platform-ios team-ios
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 4 天内回复