ryoji-s 2 years ago
parent
commit
9efbb3bfc0

+ 4 - 5
apps/app/src/components/Admin/UserGroupDetail/UserGroupUserFormByInput.tsx

@@ -1,4 +1,4 @@
-import type { FC } from 'react';
+import type { FC, KeyboardEvent } from 'react';
 import React, { useState } from 'react';
 
 import type { IUserGroupHasId, IUserHasId } from '@growi/core';
@@ -64,7 +64,7 @@ export const UserGroupUserFormByInput: FC<Props> = (props) => {
     setInputUser(inputUser);
   };
 
-  const handleSearch = (keyword) => {
+  const handleSearch = (keyword: string) => {
     if (keyword === '') {
       return;
     }
@@ -74,9 +74,8 @@ export const UserGroupUserFormByInput: FC<Props> = (props) => {
     searchApplicableUsersDebounce();
   };
 
-  const onKeyDown = (event) => {
-    // 13 is Enter key
-    if (event.keyCode === 13) {
+  const onKeyDown = (event: KeyboardEvent) => {
+    if (event.key === 'Enter') {
       addUserBySubmit();
     }
   };

+ 4 - 4
apps/app/src/components/PageTags/TagsInput.tsx

@@ -27,7 +27,7 @@ export const TagsInput: FC<Props> = (props: Props) => {
     onTagsUpdated(selected);
   }, [onTagsUpdated]);
 
-  const searchHandler = useCallback(async(query: string) => {
+  const searchHandler = useCallback((query: string) => {
     const tagsSearchData = tagsSearch?.tags || [];
     setSearchQuery(query);
     tagsSearchData.unshift(query);
@@ -38,15 +38,15 @@ export const TagsInput: FC<Props> = (props: Props) => {
     <div className="tag-typeahead">
       <AsyncTypeahead
         id="tag-typeahead-asynctypeahead"
-        options={resultTags} // Search result (Some tag names)
         isLoading={isLoading}
-        onSearch={searchHandler}
+        minLength={1}
         defaultSelected={tags}
         multiple
         onChange={changeHandler}
+        onSearch={searchHandler}
+        options={resultTags} // Search result (Some tag names)
         placeholder={t('tag_edit_modal.tags_input.tag_name')}
         autoFocus={autoFocus}
-        minLength={1}
       />
     </div>
   );