[PR #4398] [MERGED] refactor: database cell controller and builder #6234

Closed
opened 2026-03-23 22:22:19 +00:00 by mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/AppFlowy-IO/AppFlowy/pull/4398
Author: @richardshiue
Created: 1/15/2024
Status: Merged
Merged: 1/24/2024
Merged by: @appflowy

Base: mainHead: refactor/database-bloc


📝 Commits (10+)

  • adb08a2 refactor: get row/field data from row cache and field controller in cell controller
  • a87038c refactor: reorganize cell controller tasks and builder
  • 83c5420 refactor: rename cell_builder.dart
  • 414f7d9 refactor: database editable cell builder
  • 1da0ec9 refactor: database card cell builder
  • d6da813 fix: make it work
  • 1fcfa5b fix: start cell listener and adjust cell style on desktop
  • f9fedde fix: build card cell
  • 98c64fc fix: remove unnecessary await in tests
  • dcbb7b8 fix: cell cache validation

📊 Changes

185 files changed (+6507 additions, -7656 deletions)

View changed files

📝 frontend/appflowy_flutter/analysis_options.yaml (+1 -0)
📝 frontend/appflowy_flutter/integration_test/board/board_add_row_test.dart (+11 -13)
📝 frontend/appflowy_flutter/integration_test/board/board_group_test.dart (+5 -5)
📝 frontend/appflowy_flutter/integration_test/board/board_row_test.dart (+5 -5)
📝 frontend/appflowy_flutter/integration_test/database/database_cell_test.dart (+12 -6)
📝 frontend/appflowy_flutter/integration_test/database/database_field_test.dart (+193 -8)
📝 frontend/appflowy_flutter/integration_test/database/database_reminder_test.dart (+4 -4)
📝 frontend/appflowy_flutter/integration_test/database/database_row_page_test.dart (+12 -23)
📝 frontend/appflowy_flutter/integration_test/database/database_share_test.dart (+2 -1)
📝 frontend/appflowy_flutter/integration_test/document/document_with_database_test.dart (+2 -2)
📝 frontend/appflowy_flutter/integration_test/util/database_test_op.dart (+95 -84)
📝 frontend/appflowy_flutter/lib/mobile/presentation/database/board/mobile_board_content.dart (+19 -37)
📝 frontend/appflowy_flutter/lib/mobile/presentation/database/board/widgets/mobile_hidden_groups_column.dart (+94 -163)
📝 frontend/appflowy_flutter/lib/mobile/presentation/database/card/card.dart (+1 -1)
frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_content/card_cells/card_cells.dart (+0 -9)
frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_content/card_cells/checkbox.dart (+0 -68)
frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_content/card_cells/checklist.dart (+0 -137)
frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_content/card_cells/date.dart (+0 -74)
frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_content/card_cells/number.dart (+0 -76)
frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_content/card_cells/select_option.dart (+0 -147)

...and 80 more files

📄 Description

  • The goal of this PR is to make cell controllers less reliant on the DatabaseCellContext (now renamed to CellContext), because this class previously also contains the RowMetaPB and FieldInfo. As a result, extra work was required to make sure that the DatabaseCellContext is always up to date. We should instead grab this info from the RowCache and FieldController, and add listeners to them to update the cells. Doing so also leads to less widget rebuilds since the cell blocs and controllers don't have to be re-instantiated.
  • The creation of CellController is also now more streamlined. See frontend/appflowy_flutter/lib/plugins/database/application/cell/cell_controller_builder.dart
  • Fix the mess that is the GridCellBuilder. In the mobile sprints, lots of unplanned copy and pasting was done to meet the deadline. See frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_builder.dart and card_cell_builder.dart.
  • Resolves #3502, adding tests targeting field type option changes and making sure that field changes are propagated to cell controllers.

Feature Preview


PR Checklist

  • My code adheres to AppFlowy's Conventions
  • I've listed at least one issue that this PR fixes in the description above.
  • I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes.
  • All existing tests are passing.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/AppFlowy-IO/AppFlowy/pull/4398 **Author:** [@richardshiue](https://github.com/richardshiue) **Created:** 1/15/2024 **Status:** ✅ Merged **Merged:** 1/24/2024 **Merged by:** [@appflowy](https://github.com/appflowy) **Base:** `main` ← **Head:** `refactor/database-bloc` --- ### 📝 Commits (10+) - [`adb08a2`](https://github.com/AppFlowy-IO/AppFlowy/commit/adb08a2cd171de867a6513c754514cd04e72aff7) refactor: get row/field data from row cache and field controller in cell controller - [`a87038c`](https://github.com/AppFlowy-IO/AppFlowy/commit/a87038c396d09345b90aab6e12de1af72b72421b) refactor: reorganize cell controller tasks and builder - [`83c5420`](https://github.com/AppFlowy-IO/AppFlowy/commit/83c5420b0ac5b89ea489b10dc7f3092128bf8d08) refactor: rename cell_builder.dart - [`414f7d9`](https://github.com/AppFlowy-IO/AppFlowy/commit/414f7d92ad544f1ce07b48595114634dc6f09027) refactor: database editable cell builder - [`1da0ec9`](https://github.com/AppFlowy-IO/AppFlowy/commit/1da0ec994b24c788661142c8ab88c97993af310f) refactor: database card cell builder - [`d6da813`](https://github.com/AppFlowy-IO/AppFlowy/commit/d6da81345bbef53884b227f58a9bd0eae7894e9c) fix: make it work - [`1fcfa5b`](https://github.com/AppFlowy-IO/AppFlowy/commit/1fcfa5b7b470502910b91edca636c9d34f8adcaf) fix: start cell listener and adjust cell style on desktop - [`f9fedde`](https://github.com/AppFlowy-IO/AppFlowy/commit/f9feddea12e7818694feff4f9fc000ff766d736c) fix: build card cell - [`98c64fc`](https://github.com/AppFlowy-IO/AppFlowy/commit/98c64fc88b87b9aabd5d0e8e27af0bf0ac4ebe06) fix: remove unnecessary await in tests - [`dcbb7b8`](https://github.com/AppFlowy-IO/AppFlowy/commit/dcbb7b8a9543067c80e97b52c79b3cda364c25e1) fix: cell cache validation ### 📊 Changes **185 files changed** (+6507 additions, -7656 deletions) <details> <summary>View changed files</summary> 📝 `frontend/appflowy_flutter/analysis_options.yaml` (+1 -0) 📝 `frontend/appflowy_flutter/integration_test/board/board_add_row_test.dart` (+11 -13) 📝 `frontend/appflowy_flutter/integration_test/board/board_group_test.dart` (+5 -5) 📝 `frontend/appflowy_flutter/integration_test/board/board_row_test.dart` (+5 -5) 📝 `frontend/appflowy_flutter/integration_test/database/database_cell_test.dart` (+12 -6) 📝 `frontend/appflowy_flutter/integration_test/database/database_field_test.dart` (+193 -8) 📝 `frontend/appflowy_flutter/integration_test/database/database_reminder_test.dart` (+4 -4) 📝 `frontend/appflowy_flutter/integration_test/database/database_row_page_test.dart` (+12 -23) 📝 `frontend/appflowy_flutter/integration_test/database/database_share_test.dart` (+2 -1) 📝 `frontend/appflowy_flutter/integration_test/document/document_with_database_test.dart` (+2 -2) 📝 `frontend/appflowy_flutter/integration_test/util/database_test_op.dart` (+95 -84) 📝 `frontend/appflowy_flutter/lib/mobile/presentation/database/board/mobile_board_content.dart` (+19 -37) 📝 `frontend/appflowy_flutter/lib/mobile/presentation/database/board/widgets/mobile_hidden_groups_column.dart` (+94 -163) 📝 `frontend/appflowy_flutter/lib/mobile/presentation/database/card/card.dart` (+1 -1) ➖ `frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_content/card_cells/card_cells.dart` (+0 -9) ➖ `frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_content/card_cells/checkbox.dart` (+0 -68) ➖ `frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_content/card_cells/checklist.dart` (+0 -137) ➖ `frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_content/card_cells/date.dart` (+0 -74) ➖ `frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_content/card_cells/number.dart` (+0 -76) ➖ `frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_content/card_cells/select_option.dart` (+0 -147) _...and 80 more files_ </details> ### 📄 Description - The goal of this PR is to make cell controllers less reliant on the `DatabaseCellContext` (now renamed to `CellContext`), because this class previously also contains the `RowMetaPB` and `FieldInfo`. As a result, extra work was required to make sure that the `DatabaseCellContext` is always up to date. We should instead grab this info from the `RowCache` and `FieldController`, and add listeners to them to update the cells. Doing so also leads to less widget rebuilds since the cell blocs and controllers don't have to be re-instantiated. - The creation of `CellController` is also now more streamlined. See `frontend/appflowy_flutter/lib/plugins/database/application/cell/cell_controller_builder.dart` - Fix the mess that is the `GridCellBuilder`. In the mobile sprints, lots of unplanned copy and pasting was done to meet the deadline. See `frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_builder.dart` and `card_cell_builder.dart`. - Resolves #3502, adding tests targeting field type option changes and making sure that field changes are propagated to cell controllers. ### Feature Preview <!--- List at least one issue here that this PR addresses. If it fixes the issue, please use the [fixes](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests) keyword to close the issue. For example: fixes https://github.com/AppFlowy-IO/AppFlowy/pull/2106 --> --- <!--- Before you mark this PR ready for review, run through this checklist! --> #### PR Checklist - [x] My code adheres to [AppFlowy's Conventions](https://docs.appflowy.io/docs/documentation/software-contributions/conventions) - [x] I've listed at least one issue that this PR fixes in the description above. - [x] I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes. - [ ] All existing tests are passing. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
mirror 2026-03-23 22:22:19 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
AppFlowy-IO/AppFlowy#6234
No description provided.