fix(demos): snapshot validated values before asynchronous submissions
This commit is contained in:
@@ -22,10 +22,11 @@ let timer: ReturnType<typeof setTimeout> | undefined;
|
||||
onBeforeUnmount(() => clearTimeout(timer));
|
||||
function submit() {
|
||||
if (value.value.length < 3 || isSubmitting.value) return;
|
||||
const submittedValue = value.value;
|
||||
isSubmitting.value = true;
|
||||
// Simulate API call
|
||||
timer = setTimeout(() => {
|
||||
console.log("Search submitted:", { query: value.value });
|
||||
console.log("Search submitted:", { query: submittedValue });
|
||||
value.value = "";
|
||||
isSubmitting.value = false;
|
||||
}, 1500);
|
||||
|
||||
Reference in New Issue
Block a user