Skip to content

Conversation

@chenxi-20
Copy link
Collaborator

@chenxi-20 chenxi-20 commented Sep 11, 2025

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Bug Fixes
    • Slider now immediately refreshes bar and handle styling when switching between vertical and horizontal modes, preventing stale or misaligned visuals.
    • Ensures correct layout when the orientation changes at runtime, without needing a reload or manual refresh.
    • Improves visual consistency and responsiveness for sliders used in dynamic layouts or settings panels.

@chenxi-20 chenxi-20 added the bug Something isn't working label Sep 11, 2025
@coderabbitai
Copy link

coderabbitai bot commented Sep 11, 2025

Walkthrough

A watcher was added in packages/renderless/src/slider/vue.ts to observe changes to the vertical prop and trigger api.setBarStyle() and api.setButtonStyle() when it toggles. No other logic, error handling, or public API signatures were modified.

Changes

Cohort / File(s) Summary
Slider orientation watcher
packages/renderless/src/slider/vue.ts
Added a watcher on props.vertical that invokes api.setBarStyle() and api.setButtonStyle() upon change to refresh orientation-dependent styles.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Vue as Vue Component
    participant Watcher as vertical Watcher
    participant API as Slider API

    User->>Vue: Toggle prop: vertical
    Vue-->>Watcher: Detect change (vertical)
    Note over Watcher: Orientation changed
    Watcher->>API: setBarStyle()
    Watcher->>API: setButtonStyle()
    API-->>Vue: Styles updated
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks (3 passed)

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly and specifically reflects the primary change: it describes a bugfix to the slider's horizontal/vertical mode conversion, which matches the code that refreshes orientation-related styles when the vertical prop changes. It is concise and informative for a teammate scanning PR history.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Poem

I tilt my ears from flat to tall,
A slider turns—no fuss at all.
Bars realign, buttons preen,
Vertical dreams in glossy sheen.
Hop, flip, style refreshed anew—
Carrots approve this tidy view. 🥕✨

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/slider-20250911

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7284629 and 2a0e3d4.

📒 Files selected for processing (1)
  • packages/renderless/src/slider/vue.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: PR E2E Test (pnpm test:e2e3)

Comment on lines +207 to +213
watch(
() => props.vertical,
() => {
api.setBarStyle()
api.setButtonStyle()
}
)
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Run the orientation watcher after DOM updates; also refresh all orientation-dependent metrics.

By default, watch callbacks run before the DOM flush; if setBarStyle/setButtonStyle read sizes/classes, results can be stale. Run with flush:'post' and refresh tip/marks as they depend on orientation too.

-  watch(
-    () => props.vertical,
-    () => {
-      api.setBarStyle()
-      api.setButtonStyle()
-    }
-  )
+  watch(
+    () => props.vertical,
+    () => {
+      api.setBarStyle()
+      api.setButtonStyle()
+      api.setTipStyle()
+      api.getPoints()
+      api.getLabels()
+    },
+    { flush: 'post' }
+  )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
watch(
() => props.vertical,
() => {
api.setBarStyle()
api.setButtonStyle()
}
)
watch(
() => props.vertical,
() => {
api.setBarStyle()
api.setButtonStyle()
api.setTipStyle()
api.getPoints()
api.getLabels()
},
{ flush: 'post' }
)
🤖 Prompt for AI Agents
In packages/renderless/src/slider/vue.ts around lines 207 to 213, the watcher
for props.vertical runs before the DOM is flushed and only updates bar/button
styles; change the watch to run after DOM updates by adding { flush: 'post' }
and also refresh orientation-dependent metrics by invoking the tip and marks
update methods (e.g., api.setTipStyle() and api.setMarks() or their equivalents)
alongside api.setBarStyle() and api.setButtonStyle() so tip/marks reflect the
new orientation.

@zzcr zzcr merged commit 2e311f3 into dev Sep 18, 2025
10 of 11 checks passed
@zzcr zzcr deleted the fix/slider-20250911 branch September 18, 2025 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants