Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/renderless/src/slider/vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,13 @@ export const renderless = (
api.setActiveButtonValue(value)
}
)
watch(
() => props.vertical,
() => {
api.setBarStyle()
api.setButtonStyle()
}
)
Comment on lines +207 to +213
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.


watch(
() => state.leftBtnValue,
Expand Down
Loading