File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
frontend/routes/@[scope]/(_islands) Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 11// Copyright 2024 the JSR authors. All rights reserved. MIT license.
22import TbArrowRightFromArc from "@preact-icons/tb/TbArrowRightFromArc" ;
33import { useSignal } from "@preact/signals" ;
4+ import { useEffect } from "preact/hooks" ;
45
56export function ScopeMemberLeave ( {
67 userId,
@@ -16,6 +17,14 @@ export function ScopeMemberLeave({
1617 const scopeInput = useSignal ( "" ) ;
1718 const error = useSignal ( true ) ;
1819
20+ useEffect ( ( ) => {
21+ const handler = setTimeout ( ( ) => {
22+ validate ( ) ;
23+ } , 500 ) ;
24+
25+ return clearTimeout ( handler ) ;
26+ } , [ scopeInput . value ] ) ;
27+
1928 const validate = ( ) => {
2029 error . value = isLastAdmin ||
2130 ( scopeInput . value !== scopeName && scopeInput . value . length > 0 ) ||
@@ -53,7 +62,6 @@ export function ScopeMemberLeave({
5362 value = { scopeInput . value }
5463 onInput = { ( e ) => {
5564 scopeInput . value = ( e . target as HTMLInputElement ) . value ;
56- validate ( ) ;
5765 } }
5866 placeholder = "Scope name"
5967 />
You can’t perform that action at this time.
0 commit comments