Skip to content

fix(Slider): ensure thumb position updates when value changes externally#142

Merged
Konyaco merged 1 commit intocompose-fluent:devfrom
Moriafly:fix/slider-external-value-sync
Jan 15, 2026
Merged

fix(Slider): ensure thumb position updates when value changes externally#142
Konyaco merged 1 commit intocompose-fluent:devfrom
Moriafly:fix/slider-external-value-sync

Conversation

@Moriafly
Copy link

Slider thumb position (rawFraction) was only updated during user drag interactions. If the value was modified programmatically (e.g., via state hoisting or a reset button), the visual thumb position would remain stale and desynchronized from the actual value.

This commit adds a check in the value setter to explicitly recalculate and update rawFraction when isDragging is false, ensuring the UI correctly reflects external state changes.

Slider thumb position (rawFraction) was only updated during user drag interactions. If the `value` was modified programmatically (e.g., via state hoisting or a reset button), the visual thumb position would remain stale and desynchronized from the actual value.

This commit adds a check in the `value` setter to explicitly recalculate and update `rawFraction` when `isDragging` is false, ensuring the UI correctly reflects external state changes.
@Sanlorng Sanlorng requested a review from Konyaco January 10, 2026 11:29
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug where the Slider thumb position would not update when the value was changed programmatically (e.g., via state hoisting or external controls). The fix ensures that rawFraction, which controls the visual thumb position, is synchronized with the value property when changes occur outside of user drag interactions.

Changes:

  • Added synchronization logic in the SliderState.value setter to update rawFraction when the value changes externally (when not dragging)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Konyaco Konyaco merged commit c63ea50 into compose-fluent:dev Jan 15, 2026
7 of 16 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.

3 participants