Skip to content

Commit cff4e36

Browse files
committed
fix: useTimeoutFn; disable inputs & tooltip when controls are closed
1 parent a96d693 commit cff4e36

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

app/components/Package/TrendsChart.vue

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,27 +1360,19 @@ const chartHeight = computed(() => {
13601360
return showCorrectionControls.value && props.inModal ? 494 : 600
13611361
})
13621362
1363-
const timeoutId = shallowRef<ReturnType<typeof setTimeout> | null>(null)
1363+
const { start } = useTimeoutFn(
1364+
() => {
1365+
isResizing.value = false
1366+
},
1367+
200,
1368+
{ immediate: false },
1369+
)
13641370
13651371
function pauseChartTransitions() {
1366-
if (timeoutId.value) {
1367-
clearTimeout(timeoutId.value)
1368-
}
1369-
13701372
isResizing.value = true
1371-
1372-
timeoutId.value = setTimeout(() => {
1373-
isResizing.value = false
1374-
timeoutId.value = null
1375-
}, 200)
1373+
start()
13761374
}
13771375
1378-
onBeforeUnmount(() => {
1379-
if (timeoutId.value) {
1380-
clearTimeout(timeoutId.value)
1381-
}
1382-
})
1383-
13841376
watch(
13851377
chartHeight,
13861378
(newH, oldH) => {
@@ -1729,6 +1721,7 @@ watch(selectedMetric, value => {
17291721
</span>
17301722
<input
17311723
v-model.number="settings.chartFilter.averageWindow"
1724+
:disabled="!showCorrectionControls"
17321725
type="range"
17331726
min="0"
17341727
max="20"
@@ -1743,6 +1736,7 @@ watch(selectedMetric, value => {
17431736
</span>
17441737
<input
17451738
v-model.number="settings.chartFilter.smoothingTau"
1739+
:disabled="!showCorrectionControls"
17461740
type="range"
17471741
min="0"
17481742
max="20"
@@ -1757,6 +1751,7 @@ watch(selectedMetric, value => {
17571751
</span>
17581752
<input
17591753
v-model.number="settings.chartFilter.predictionPoints"
1754+
:disabled="!showCorrectionControls"
17601755
type="range"
17611756
min="0"
17621757
max="30"
@@ -1769,7 +1764,11 @@ watch(selectedMetric, value => {
17691764
class="text-2xs font-mono text-fg-subtle tracking-wide uppercase flex items-center justify-between"
17701765
>
17711766
{{ $t('package.trends.known_anomalies') }}
1772-
<TooltipApp interactive :to="inModal ? '#chart-modal' : undefined">
1767+
<TooltipApp
1768+
interactive
1769+
:to="inModal ? '#chart-modal' : undefined"
1770+
v-if="showCorrectionControls"
1771+
>
17731772
<button
17741773
type="button"
17751774
class="i-lucide:info w-3.5 h-3.5 text-fg-muted cursor-help"
@@ -1824,6 +1823,7 @@ watch(selectedMetric, value => {
18241823
>
18251824
<input
18261825
:checked="settings.chartFilter.anomaliesFixed"
1826+
:disabled="!showCorrectionControls"
18271827
@change="
18281828
settings.chartFilter.anomaliesFixed = (
18291829
$event.target as HTMLInputElement

0 commit comments

Comments
 (0)