Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(flutter_desktop): grid bug #7697

Merged
merged 4 commits into from
Apr 8, 2025

Conversation

richardshiue
Copy link
Collaborator

@richardshiue richardshiue commented Apr 7, 2025

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.

Summary by Sourcery

Fix a grid field settings update bug in the database view

Bug Fixes:

  • Corrected the field settings update logic to properly handle field updates in the database view

Tests:

  • Added an integration test to verify field visibility behavior across linked database views

Copy link

sourcery-ai bot commented Apr 7, 2025

Reviewer's Guide by Sourcery

This pull request fixes a bug where field settings were not being updated correctly and adds a test case to verify that hidden properties remain hidden when new fields are created. The fix involves modifying the updateFieldSettings function in field_controller.dart to correctly update the field settings. The test case adds steps to create a database, add a linked database view, create and hide a field, create another field, and verify that the hidden field remains hidden.

Sequence diagram for updating field settings

sequenceDiagram
  participant FC as FieldController
  participant FN as FieldNotifier
  participant FS as FieldSettings

  FC->FC: _listenOnFieldSettingsChanged()
  activate FC
  FC->FC: updateFieldSettings(updatedFieldSettings)
  FC->FS: removeWhere(field.fieldId == updatedFieldSettings.fieldId)
  activate FS
  deactivate FS
  FC->FS: add(updatedFieldSettings)
  activate FS
  deactivate FS
  FC->FN: fieldInfos = newFields
  activate FN
  deactivate FN
  loop For each field setting change
  end
  deactivate FC
Loading

File-Level Changes

Change Details Files
Fixed a bug where field settings were not being updated correctly when a field was updated in the backend.
  • Modified the updateFieldSettings function to correctly update the field settings in the fieldInfos list.
  • Added a check to ensure that the newFields list is not empty before attempting to update the field settings.
  • Removed unnecessary variable assignment.
  • Removed unnecessary return of updated field.
frontend/appflowy_flutter/lib/plugins/database/application/field/field_controller.dart
Added a test case to verify that hidden properties remain hidden when new fields are created.
  • Added a new test case to verify that hidden properties remain hidden when new fields are created.
  • Created a new database and added a linked database view.
  • Created a new field and hid it.
  • Created another field and verified that the hidden field remains hidden.
  • Navigated back to the inline database view and verified that the hidden field is visible.
frontend/appflowy_flutter/integration_test/desktop/database/database_field_settings_test.dart

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @richardshiue - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a more specific test case that directly targets the bug fix.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@richardshiue richardshiue changed the title fix: grid bug fix(flutter_desktop): grid bug Apr 7, 2025
@appflowy
Copy link
Contributor

appflowy commented Apr 7, 2025

@richardshiue Add an additional test to verify that when a user alters the width of a field and then updates the field settings, the width resets to its default value.

@richardshiue richardshiue merged commit 9e30b18 into AppFlowy-IO:main Apr 8, 2025
18 checks passed
@richardshiue richardshiue deleted the fix/grid-bug branch April 8, 2025 03:46
appflowy pushed a commit that referenced this pull request Apr 9, 2025
* fix: field width doesn't persist

* test: add test

* test: fix test

* test: grid width integration test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants