mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-03-12 01:59:34 -05:00
fix: remove debounce from color picker to prevent stale color on save
The color picker had a 500ms debounce before propagating the selected color to the parent component. Since all usages save via an explicit button click (not automatically), the debounce only caused a race condition where the model value could be stale when the user clicked Save within 500ms of picking a color. Closes go-vikunja/vikunja#2312
This commit is contained in:
@@ -82,7 +82,6 @@ const DEFAULT_COLORS = [
|
||||
]
|
||||
|
||||
const color = ref('')
|
||||
const lastChangeTimeout = ref<ReturnType<typeof setTimeout> | null>(null)
|
||||
const defaultColors = ref(DEFAULT_COLORS)
|
||||
const colorListID = ref(createRandomID())
|
||||
|
||||
@@ -112,13 +111,7 @@ function update(force = false) {
|
||||
return
|
||||
}
|
||||
|
||||
if (lastChangeTimeout.value !== null) {
|
||||
clearTimeout(lastChangeTimeout.value)
|
||||
}
|
||||
|
||||
lastChangeTimeout.value = setTimeout(() => {
|
||||
model.value = color.value
|
||||
}, 500)
|
||||
model.value = color.value
|
||||
}
|
||||
|
||||
function reset() {
|
||||
|
||||
Reference in New Issue
Block a user