File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
frontend/routes/@[scope]/(_islands) Expand file tree Collapse file tree 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.
21import TbArrowRightFromArc from "@preact-icons/tb/TbArrowRightFromArc" ;
32import { useSignal } from "@preact/signals" ;
3+ import { useEffect } from "preact/hooks" ;
44
55export function ScopeMemberLeave ( {
66 userId,
@@ -16,6 +16,14 @@ export function ScopeMemberLeave({
1616 const scopeInput = useSignal ( "" ) ;
1717 const error = useSignal ( true ) ;
1818
19+ useEffect ( ( ) => {
20+ const handler = setTimeout ( ( ) => {
21+ validate ( ) ;
22+ } , 500 ) ;
23+
24+ return clearTimeout ( handler ) ;
25+ } , [ scopeInput . value ] ) ;
26+
1927 const validate = ( ) => {
2028 error . value = isLastAdmin ||
2129 ( scopeInput . value !== scopeName && scopeInput . value . length > 0 ) ||
@@ -53,7 +61,6 @@ export function ScopeMemberLeave({
5361 value = { scopeInput . value }
5462 onInput = { ( e ) => {
5563 scopeInput . value = ( e . target as HTMLInputElement ) . value ;
56- validate ( ) ;
5764 } }
5865 placeholder = "Scope name"
5966 />
You can’t perform that action at this time.
0 commit comments