fix: stabilize home stack interaction lifecycle - #8951
Open
Puuuuup wants to merge 1 commit into
Open
Conversation
Contributor
Reviewer's GuideThis PR stabilizes the home stack’s interaction lifecycle by centralizing secondary view resizing logic, tightening animation and delayed-callback lifecycles, and making tab selection and sidebar interactions reflect the true UI state, backed by focused widget tests. Sequence diagram for stabilized secondary view resizer interaction lifecyclesequenceDiagram
actor User
participant SecondaryViewResizer
participant ValueNotifier_width as ValueNotifier_double
participant HoverTimer as _showHoverTimer
User->>SecondaryViewResizer: MouseRegion.onEnter
SecondaryViewResizer->>HoverTimer: Timer(_secondaryViewResizerHoverDelay)
Note over HoverTimer,SecondaryViewResizer: Timer scheduled to show hover after delay
HoverTimer-->>SecondaryViewResizer: callback
SecondaryViewResizer->>SecondaryViewResizer: [mounted] setState(isHovered = true)
User->>SecondaryViewResizer: MouseRegion.onExit
SecondaryViewResizer->>HoverTimer: _showHoverTimer.cancel()
SecondaryViewResizer->>SecondaryViewResizer: setState(isHovered = false)
User->>SecondaryViewResizer: GestureDetector.onHorizontalDragStart
SecondaryViewResizer->>SecondaryViewResizer: setState(isDragging = true)
User->>SecondaryViewResizer: GestureDetector.onHorizontalDragUpdate
SecondaryViewResizer->>SecondaryViewResizer: compute newWidth
SecondaryViewResizer->>ValueNotifier_width: notifier.value = newWidth (>= secondaryViewMinimumWidth)
alt drag ends normally
User->>SecondaryViewResizer: GestureDetector.onHorizontalDragEnd
SecondaryViewResizer->>SecondaryViewResizer: setState(isDragging = false)
else drag is canceled
User->>SecondaryViewResizer: GestureDetector.onHorizontalDragCancel
SecondaryViewResizer->>SecondaryViewResizer: setState(isDragging = false)
end
SecondaryViewResizer->>SecondaryViewResizer: dispose()
SecondaryViewResizer->>HoverTimer: _showHoverTimer.cancel()
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="frontend/appflowy_flutter/lib/workspace/presentation/home/home_stack.dart" line_range="272" />
<code_context>
widget.pageManager.showSecondaryPluginNotifier
.removeListener(onShowSecondaryChanged);
widget.pageManager.secondaryNotifier.removeListener(onSecondaryViewChanged);
+ curveAnimation.dispose();
+ animationController.dispose();
widthNotifier.dispose();
</code_context>
<issue_to_address>
**issue (bug_risk):** CurvedAnimation does not implement dispose; this will not compile.
CurvedAnimation extends Animation<double> and does not define dispose(), so curveAnimation.dispose() will not compile. The AnimationController manages the animation’s lifecycle; remove curveAnimation.dispose() and keep only animationController.dispose().
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8950
Why
The desktop home stack owns several short-lived interaction states. These include the secondary-view animation, delayed resize-handle hover, active resize drag, and selected tab state.
These states were not always cleaned up or kept in sync.
Removing a view during a delayed callback or animation could leave asynchronous work running after the view was gone. Canceling a resize gesture could leave stale resize feedback on screen. Reordering tabs could also make the selected tab disagree with the page that was actually visible.
This PR makes the lifecycle of these states explicit and keeps the rendered UI aligned with the current tab state.
What changed
.orCancelandTickerCanceledTabsState.currentIndexas the source of truth for the rendered selectionFlowyIconButtonVerification
The targeted widget tests pass.
flutter test test/widget_test/secondary_view_resizer_test.dart --no-pub2 tests passed.
The changed resizer code and its tests also pass static analysis.
flutter analyze lib/workspace/presentation/home/secondary_view_resizer.dart test/widget_test/secondary_view_resizer_test.dart --no-pubNo issues found.
git diff --checkalso passes.Full analysis of
home_stack.dartreaches source analysis, but this checkout is missing 9 generated Rust and Protobuf symbols. These errors come from generated dependencies and are unrelated to the source changes in this PR.Risk
Low to medium.
The resize behavior and visual layout are unchanged. This PR does not change the minimum width, resize hit target, animation duration, or visual dimensions.
The main behavior changes are limited to state cleanup, cancellation handling, and keeping tab selection in sync with the visible page.
PR Checklist
Summary by Sourcery
Stabilize the desktop home stack’s secondary view and tab interaction lifecycle, ensuring UI state stays consistent and is properly cleaned up during animations, resizing, and tab changes.
Bug Fixes:
Enhancements:
Tests: