Skip to content

Commit 1dd4e6a

Browse files
committed
slider interaction fix
1 parent 689598d commit 1dd4e6a

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

frontend/src/partials/BenchmarkSettings.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,19 @@ function BenchmarkSettings() {
107107
const scaledUtilization = clamp( currentServer.utilization as number * ratio, 0, 100);
108108
updateServer(newServer, { utilization: scaledUtilization });
109109
}
110+
}, [scaling, currentServer, newServer])
110111

112+
// Only want the new slider to update of the scaling is clicked, not when the current
113+
// slider is moved around, unlike the above useEffect
114+
useEffect(() => {
111115
if (scaling === "Emissions") {
112116
updateServer(newServer, { utilization: currentServer.utilization });
113117
}
114118

115119
if (scaling === "None") {
116120
updateServer(newServer, { utilization: currentServer.utilization });
117121
}
118-
119-
}, [scaling, currentServer, newServer])
122+
}, [scaling])
120123

121124
return (
122125
<div className="flex z-30 flex-col text-medium font-medium flex-wrap px-4 py-2 gap-4">

0 commit comments

Comments
 (0)