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