Skip to content

Optim/stablestate monolitic fix#1180

Merged
theovilardo merged 2 commits intomasterfrom
optim/stablestate-monolitic-fix
Feb 21, 2026
Merged

Optim/stablestate monolitic fix#1180
theovilardo merged 2 commits intomasterfrom
optim/stablestate-monolitic-fix

Conversation

@theovilardo
Copy link
Copy Markdown
Owner

No description provided.

…d performance

- **Playback & State Management**:
    - Remove `currentPosition` from `StablePlayerState` to prevent high-frequency updates from triggering global UI recompositions.
    - Introduce a dedicated `currentPosition` StateFlow in `PlaybackStateHolder` and `PlayerViewModel` for real-time tracking (e.g., seek bars, lyrics).
    - Deprecate `stablePlayerStateInfrequent` in favor of a unified `stablePlayerState`, as structural state changes are now naturally separated from position updates.
    - Add `setCurrentPosition` to `PlaybackStateHolder` to provide a centralized way to update playback progress.
- **ViewModel & Logic**:
    - Update `PlayerViewModel`, `PlaybackStateHolder`, and `CastTransferStateHolder` to use the new position flow for seek operations, remote playback syncing, and progress tracking.
    - Ensure `listeningStatsTracker` continues to receive accurate progress updates via the new position stream.
- **UI Components**:
    - Refactor all screens and components (including `UnifiedPlayerSheet`, `LibraryScreen`, `SearchScreen`, and `FullPlayerContent`) to collect `stablePlayerState` and `currentPlaybackPosition` independently.
    - Update `LyricsSheet` to use the separated position flow for accurate timing.
- **ComposeLoader**: Refactor `rememberSmoothProgress` to remove heavy `animateFloatAsState` recompositions. Visual interpolation logic is moved to the draw phase of specific components to reduce recomposition frequency from ~60 FPS to ~5 FPS during progress updates.
- **WavySliderExpressive**:
    - Implement frame-clock based visual interpolation using `withFrameNanos` to ensure smooth slider movement without triggering high-frequency recompositions.
    - Decouple `renderedNormalizedProgress` from the main composition cycle by updating it within a `LaunchedEffect`.
    - Consume the interpolated progress value directly in `LinearWavyProgressIndicator` and the thumb drawing logic.
- **FullPlayerContent**: Pass `interactionSource` to the expressive wavy slider to ensure correct interaction state tracking.
@theovilardo theovilardo merged commit d16b90e into master Feb 21, 2026
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