Skip to content

fix: v0.9.2 launch review issues #7898

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

Merged
merged 11 commits into from
May 9, 2025
Merged

Conversation

LucasXu0
Copy link
Collaborator

@LucasXu0 LucasXu0 commented May 8, 2025

Feature Preview

  • message loading issue
  • remove empty paragraphs after inserting file block
  • remove opacity from locked page icon
  • open the space after opening the view
  • chat page animation
  • cover title may lost text sometimes

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

Address various UI and user experience issues in the AppFlowy application, focusing on chat, document editing, and workspace navigation

New Features:

  • Implemented automatic space switching when opening a view

Bug Fixes:

  • Fixed message loading in chat interface
  • Resolved issue with empty paragraphs when inserting file blocks
  • Removed opacity from locked page icon
  • Improved chat list scrolling behavior

Enhancements:

  • Improved space switching when opening views
  • Added debounce for loading previous messages
  • Optimized initial scroll behavior in chat list

Tests:

  • Added unit tests for file block insertion in different document scenarios

Copy link
Contributor

sourcery-ai bot commented May 8, 2025

Reviewer's Guide

This pull request addresses several issues identified during the v0.9.2 launch review. It refines chat message loading and animations by implementing debounced loading for previous messages and adjusting scroll behavior. File block insertion in the editor is improved to replace empty paragraphs directly. Navigation is enhanced by automatically switching to a view's parent space upon opening. A UI glitch causing opacity on the locked page icon has been fixed. Finally, iOS pod dependencies have been updated.

Class Diagram: Key Changes in v0.9.2 Launch Review Fixes

classDiagram
    class ChatAnimatedListState {
        +Debounce _loadPreviousMessagesDebounce
        +initState() void
        +build(BuildContext context) Widget
        +dispose() void
        +_handleLoadPreviousMessages() void
        +_onInserted(int position, Message data) void
        +_handleToggleScrollToBottom() void
    }
    note for ChatAnimatedListState "Manages the animated list of chat messages.\n- Added Debounce _loadPreviousMessagesDebounce for fetching older messages.\n- initState() registers a listener to trigger _handleLoadPreviousMessages on scroll.\n- build() logic updated for initial scroll position and spacing.\n- _onInserted() updated for item insertion animation.\n- _handleToggleScrollToBottom() logic refined for showing/hiding scroll button."

    class EditorStateExtension {
        <<extension>>
        +insertEmptyFileBlock(GlobalKey key) Future~void~
    }
    note for EditorStateExtension "Extension on EditorState for file block operations.\n- insertEmptyFileBlock() logic modified to replace an empty paragraph node with the file block, or insert it after the current node."

    class DesktopHomeScreen {
        +build(BuildContext context) Widget
        -_switchToSpace(ViewPB view) Future~void~
    }
    note for DesktopHomeScreen "Main screen for desktop.\n- When a view is opened, it now calls _switchToSpace to potentially switch to the view's parent space.\n- Uses ViewBackendService to get view ancestors and switchToSpaceIdNotifier to trigger the space switch."

    class _SpaceState {
        +initState() void
        +dispose() void
        -_switchToSpace() void
    }
    note for _SpaceState "State for a space item in the sidebar.\n- initState() now listens to switchToSpaceIdNotifier.\n- _switchToSpace() is called when the notifier fires, triggering a SpaceBloc event to open the specified space."

    class LockPageButtonWrapper {
        +build(BuildContext context) Widget
    }
    note for LockPageButtonWrapper "Wrapper for the lock page button.\n- Removed Opacity widget to fix UI glitch where icon was semi-transparent when locked."

    class GlobalNotifiers {
      <<New>>
      +ValueNotifier~ViewPB?~ switchToSpaceIdNotifier
    }
    note for GlobalNotifiers "New global ValueNotifier.\n- switchToSpaceIdNotifier is used to communicate the need to switch to a specific space (identified by ViewPB) from DesktopHomeScreen to _SpaceState."

    ChatAnimatedListState ..> Debounce : uses
    ChatAnimatedListState ..> Message : uses
    DesktopHomeScreen ..> GlobalNotifiers : uses switchToSpaceIdNotifier
    DesktopHomeScreen ..> ViewPB : uses
    _SpaceState ..> GlobalNotifiers : listens to switchToSpaceIdNotifier

    class Debounce {
        +Debounce(Duration duration)
        +call(Function callback) void
    }
    class ViewPB {
        +String id
        +isSpace() bool
    }
    class Message {
        // Message properties
    }
Loading

File-Level Changes

Change Details Files
Enhanced chat message loading, scrolling, and animation.
  • Implemented debounced loading of previous messages when scrolling to the top.
  • Adjusted initial scroll index and alignment for new messages to improve user experience.
  • Refined logic for toggling the 'scroll to bottom' button visibility.
  • Updated message insertion to use list animations.
frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/animated_chat_list.dart
Improved file block insertion behavior in the document editor.
  • Modified file block insertion to replace the current node if it's an empty paragraph.
  • Added unit tests to verify file block insertion in both empty and non-empty paragraphs.
frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/file/file_selection_menu.dart
frontend/appflowy_flutter/test/unit_test/editor/file_block_test.dart
Implemented automatic space switching when opening a view.
  • Added logic to determine and switch to the space containing a newly opened view.
  • Introduced a global notifier to manage and trigger the space switch.
frontend/appflowy_flutter/lib/workspace/presentation/home/desktop_home_screen.dart
frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/space/sidebar_space.dart
frontend/appflowy_flutter/lib/workspace/presentation/home/hotkeys.dart
Corrected locked page icon appearance.
  • Removed the opacity effect from the locked page icon, ensuring it's always fully visible.
frontend/appflowy_flutter/lib/workspace/presentation/widgets/more_view_actions/widgets/lock_page_action.dart
Updated iOS pod dependencies.
  • Refreshed versions of iOS dependencies.
frontend/appflowy_flutter/ios/Podfile.lock

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!

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
Contributor

@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 @LucasXu0 - I've reviewed your changes - here's some feedback:

  • _oldList in ChatAnimatedListState may become outdated after inserts/removals, affecting subsequent _onUpdated diffs.
  • Please clarify how list animations in ChatAnimatedListState are handled after _onInserted/_onRemoved/_onMoved calls were removed from the event stream.
  • The _onInserted method in ChatAnimatedListState uses a hardcoded index 0 for insertItem while its logic also depends on the position argument; this seems inconsistent.
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.

@LucasXu0 LucasXu0 merged commit d3ce59f into AppFlowy-IO:main May 9, 2025
15 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant