File tree 1 file changed +9
-1
lines changed
frontend/routes/@[scope]/(_islands)
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 1
1
// Copyright 2024 the JSR authors. All rights reserved. MIT license.
2
2
import TbArrowRightFromArc from "@preact-icons/tb/TbArrowRightFromArc" ;
3
3
import { useSignal } from "@preact/signals" ;
4
+ import { useEffect } from "preact/hooks" ;
4
5
5
6
export function ScopeMemberLeave ( {
6
7
userId,
@@ -16,6 +17,14 @@ export function ScopeMemberLeave({
16
17
const scopeInput = useSignal ( "" ) ;
17
18
const error = useSignal ( true ) ;
18
19
20
+ useEffect ( ( ) => {
21
+ const handler = setTimeout ( ( ) => {
22
+ validate ( ) ;
23
+ } , 500 ) ;
24
+
25
+ return clearTimeout ( handler ) ;
26
+ } , [ scopeInput . value ] ) ;
27
+
19
28
const validate = ( ) => {
20
29
error . value = isLastAdmin ||
21
30
( scopeInput . value !== scopeName && scopeInput . value . length > 0 ) ||
@@ -53,7 +62,6 @@ export function ScopeMemberLeave({
53
62
value = { scopeInput . value }
54
63
onInput = { ( e ) => {
55
64
scopeInput . value = ( e . target as HTMLInputElement ) . value ;
56
- validate ( ) ;
57
65
} }
58
66
placeholder = "Scope name"
59
67
/>
You can’t perform that action at this time.
0 commit comments