mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-12-23 00:39:47 +01:00
Improve a11y (#1841)
Improve accessibility by removing unnecessary tags without hrefs. Also remove many eslint errors and warnings.
This commit is contained in:
@@ -37,25 +37,25 @@ export type UseSourcesOptions = {
|
||||
|
||||
const UseSourcesDefaultOptions: UseSourcesOptions = {
|
||||
enabled: true,
|
||||
refetchPartialInterval: 3000
|
||||
refetchPartialInterval: 3000,
|
||||
};
|
||||
|
||||
export const useSources = (repository: Repository, opts: UseSourcesOptions = UseSourcesDefaultOptions) => {
|
||||
const options = {
|
||||
...UseSourcesDefaultOptions,
|
||||
...opts
|
||||
...opts,
|
||||
};
|
||||
const link = createSourcesLink(repository, options);
|
||||
const { isLoading, error, data, isFetchingNextPage, fetchNextPage, refetch } = useInfiniteQuery<File, Error, File>(
|
||||
repoQueryKey(repository, "sources", options.revision || "", options.path || ""),
|
||||
({ pageParam }) => {
|
||||
return apiClient.get(pageParam || link).then(response => response.json());
|
||||
return apiClient.get(pageParam || link).then((response) => response.json());
|
||||
},
|
||||
{
|
||||
enabled: options.enabled,
|
||||
getNextPageParam: lastPage => {
|
||||
getNextPageParam: (lastPage) => {
|
||||
return (lastPage._links.proceed as Link)?.href;
|
||||
}
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -64,7 +64,7 @@ export const useSources = (repository: Repository, opts: UseSourcesOptions = Use
|
||||
const intervalId = setInterval(() => {
|
||||
if (isPartial(file)) {
|
||||
refetch({
|
||||
throwOnError: true
|
||||
throwOnError: true,
|
||||
});
|
||||
}
|
||||
}, options.refetchPartialInterval);
|
||||
@@ -79,7 +79,7 @@ export const useSources = (repository: Repository, opts: UseSourcesOptions = Use
|
||||
fetchNextPage: () => {
|
||||
// wrapped because we do not want to leak react-query types in our api
|
||||
fetchNextPage();
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@@ -108,8 +108,8 @@ const merge = (files?: File[]): File | undefined => {
|
||||
...lastPage,
|
||||
_embedded: {
|
||||
...lastPage._embedded,
|
||||
children
|
||||
}
|
||||
children,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user