Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hang on logout #491

Merged
merged 1 commit into from
Sep 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/components/files/FileActions/FileVersions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,15 @@ export const FileVersions: FC<FileVersionsProps> = (props) => {
const classes = useStyles();

const id = file?.id ?? '';
const shouldSkipQuery = !file;
const { data, loading } = useFileVersionsQuery({
variables: { id },
skip: !file,
// Workaround for a known bug in Apollo client that causes
// `skip` to suddenly be ignored when `client.resetStore` is
// called:
// https://github.com/apollographql/react-apollo/issues/3492#issuecomment-622573677
fetchPolicy: shouldSkipQuery ? 'cache-only' : 'cache-first',
skip: shouldSkipQuery,
});

const total = data?.file.children.total;
Expand Down
8 changes: 7 additions & 1 deletion src/scenes/Projects/Files/ProjectFilesList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,17 @@ const ProjectFilesListWrapped: FC = () => {

const isNotRootDirectory = directoryId !== rootDirectoryId;

const shouldSkipQuery = !directoryId;
const { data, loading, error } = useProjectDirectoryQuery({
variables: {
id: directoryId,
},
skip: !directoryId,
// Workaround for a known bug in Apollo client that causes
// `skip` to suddenly be ignored when `client.resetStore` is
// called:
// https://github.com/apollographql/react-apollo/issues/3492#issuecomment-622573677
fetchPolicy: shouldSkipQuery ? 'cache-only' : 'cache-first',
skip: shouldSkipQuery,
});

const parents = data?.directory.parents;
Expand Down