Fixed missing update if content of diff changes (#1714)

* Fixed missing update if content of diff changes

* Add property to disable automatic refetch in diffs

Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com>
This commit is contained in:
Sebastian Sdorra
2021-06-30 16:36:26 +02:00
committed by GitHub
parent 59c15feb87
commit e5ebb78146
7 changed files with 4515 additions and 81 deletions

View File

@@ -36,6 +36,7 @@ import styled from "styled-components";
type Props = DiffObjectProps & {
url: string;
limit?: number;
refetchOnWindowFocus?: boolean;
};
type NotificationProps = {
@@ -59,8 +60,8 @@ const PartialNotification: FC<NotificationProps> = ({ fetchNextPage, isFetchingN
);
};
const LoadingDiff: FC<Props> = ({ url, limit, ...props }) => {
const { error, isLoading, data, fetchNextPage, isFetchingNextPage } = useDiff(url, { limit });
const LoadingDiff: FC<Props> = ({ url, limit, refetchOnWindowFocus, ...props }) => {
const { error, isLoading, data, fetchNextPage, isFetchingNextPage } = useDiff(url, { limit, refetchOnWindowFocus });
const [t] = useTranslation("repos");
if (error) {
@@ -86,7 +87,8 @@ const LoadingDiff: FC<Props> = ({ url, limit, ...props }) => {
LoadingDiff.defaultProps = {
limit: 25,
sideBySide: false
sideBySide: false,
refetchOnWindowFocus: true,
};
export default LoadingDiff;