Merge pull request #5267 from MiguelRamBalt/bug/APIs-search-box

add debounce time for apis-docs
This commit is contained in:
Ben Lambert
2021-04-09 16:43:47 +02:00
committed by GitHub
4 changed files with 11 additions and 1 deletions
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/core': patch
'@backstage/plugin-api-docs': patch
---
add debounce time attribute for apis-docs for search, giving more time to the users when they are typing.
+2
View File
@@ -13,6 +13,7 @@ Cloudformation
Codecov
Codehilite
Config
Debounce
Discoverability
Dockerfile
Dockerize
@@ -111,6 +112,7 @@ cookiecutter
css
dataflow
deadnaming
debounce
declaratively
destructured
dev
@@ -58,6 +58,7 @@ type SetQueryParams<T> = (params: T) => void;
export function useQueryParamState<T>(
stateName: string,
debounceTime: number = 100,
): [T | undefined, SetQueryParams<T>] {
const navigate = useNavigate();
const location = useLocation();
@@ -85,7 +86,7 @@ export function useQueryParamState<T>(
navigate({ ...location, search: `?${queryString}` }, { replace: true });
}
},
100,
debounceTime,
[queryParamState],
);
@@ -156,6 +156,7 @@ export const ApiExplorerTable = ({
}: ExplorerTableProps) => {
const [queryParamState, setQueryParamState] = useQueryParamState<TableState>(
'apiTable',
500,
);
if (error) {