early return from debounce if input didn't change

This commit is contained in:
krawieck 2020-09-21 23:49:20 +02:00
parent 521cf3fbd0
commit 13ee72e814
1 changed files with 2 additions and 0 deletions

View File

@ -24,7 +24,9 @@ class AddInstancePage extends HookWidget {
final isSite = useState<bool>(null);
final loading = useState(false);
final icon = useState<String>(null);
final prevInput = usePrevious<String>(instanceController.text);
final debounce = useDebounce(() async {
if (prevInput == instanceController.text) return;
if (instanceController.text.isEmpty) {
isSite.value = null;
return;