fix(PrompterView): prevent jumping/scrolling to undesired positions#1615
fix(PrompterView): prevent jumping/scrolling to undesired positions#1615ianshade wants to merge 2 commits intoSofie-Automation:mainfrom
Conversation
… into another part
WalkthroughThis pull request introduces a continuation mechanism for prompter pieces and implements a context-based store for managing animation state. The prompter data structure is extended to track piece continuations and part IDs, while the view layer implements state management for scroll animations and enhanced rendering to handle continuation pieces. Changes
Sequence Diagram(s)sequenceDiagram
participant Component as PrompterViewContent
participant Store as PrompterStore
participant Animation as Animation Handler
participant Scroll as Scroll Handler
Animation->>Store: Animation starts
Store->>Store: Set isFrozen = true
Note over Store: Throttle updates during animation
Animation->>Scroll: Trigger scroll to part
Scroll->>Component: scrollToPartInstanceIfNotContinuation()
Component->>Component: Query DOM (exclude continuation pieces)
Component->>Component: Execute scrollTo
Animation->>Animation: Animation completes
Animation->>Store: Animation ends
Store->>Store: Set isFrozen = false
Note over Component: Resume normal updates
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
this prevents from restoring scroll anchors during pending animations, which led to the content stopping at an undesired position
9a2e470 to
3343913
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
About the Contributor
This pull request is posted on behalf of TV 2 Norge
Type of Contribution
This is a:
Bug fix
Current Behavior
New Behavior
Testing
Unit tests are needed, but the existing components don't look very testable without significant refactoring - help to get this covered by tests is welcome
Affected areas
Time Frame
Other Information
continuationOfIdanddata-live-continuation-ofattributes. When a part takes over an infinite script, the original script is hidden from the original part. The prompter also avoids scrolling to parts that are merely continuing a script (using thescrollToPartInstanceIfNotContinuationmethod), and scroll anchors prioritize the continuation over the original piece.Status
Summary
This PR addresses undesired scrolling and jumping behavior in the Prompter View component by deferring scroll-anchor restoration during animations and properly handling script continuations across parts.
Problem
Two specific issues were occurring:
Solution
Scroll Animation Freezing
PrompterStoremechanism with aPrompterStoreContextandPrompterStoreProvidercomponent to coordinate scroll animation state across componentsisFrozenflag is set totrueat the start of scroll animations and reset tofalseupon completionContinuation Handling
PrompterDataPieceinterface withcontinuationOfandstartPartIdfields to track script continuationscontinuationOfand inherit thestartPartIdscrollToPartInstanceIfNotContinuationmethod prevents scrolling directly to continuation piecesPIECE_CONTINUATION_CLASSanddata-live-continuation-ofattributes in the DOMRelated Implementation Details
FROZEN_UPDATE_THROTTLE(50ms) andPIECE_CONTINUATION_CLASSfor managing throttling and stylinggetScrollAnchorsandrestoreScrollAnchorlogic to account for live continuationscontinuationOfIdto support intelligent restoration prioritizationFiles Modified
packages/webui/src/client/ui/Prompter/PrompterView.tsx(+143/-36 lines)packages/webui/src/client/ui/Prompter/prompter.ts(+12/-1 lines)Testing & Status