Skip to content

fix: dashboard regression: console warnings and refetchQueries #425

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

Merged
merged 1 commit into from
Aug 3, 2023
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
2 changes: 1 addition & 1 deletion ui/src/lib/fetch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export async function doRemoteLoadRepo(client: ApolloClient<any>, id: string) {
fetchPolicy: "no-cache",
});
// refetch queries
await client.refetchQueries({ include: ["GetRepos", "GetCollabRepos"] });
await client.refetchQueries({ include: ["GetDashboardRepos"] });
// We need to do a deep copy here, because apollo client returned immutable objects.
let pods = res.data.repo.pods.map((pod) => ({ ...pod }));
let edges = res.data.repo.edges;
Expand Down
2 changes: 1 addition & 1 deletion ui/src/lib/store/repoMetaSlice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const createRepoMetaSlice: StateCreator<
id: repoId,
name: repoName,
},
refetchQueries: ["GetRepos", "GetCollabRepos"],
refetchQueries: ["GetDashboardRepos"],
});
set((state) =>
produce(state, (state) => {
Expand Down
96 changes: 47 additions & 49 deletions ui/src/pages/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,32 +165,32 @@ const KillRuntimeButton = ({ repo }) => {
<Box>
{/* last active: {getUpTime(info.lastActive)} */}
<Tooltip title={getUpTime(info.lastActive)} placement="top">
{/* <Box> */}
<Tooltip title="Kill runtime">
<IconButton
disabled={killing}
size="small"
sx={{
"&:hover": {
color: theme.palette.error.main,
},
}}
onClick={async () => {
killRuntime({
variables: {
sessionId: `${me.id}_${repo.id}`,
<Box>
<Tooltip title="Kill runtime">
<IconButton
disabled={killing}
size="small"
sx={{
"&:hover": {
color: theme.palette.error.main,
},
});
}}
>
{killing ? (
<CircularProgress size="14px" />
) : (
<StopCircleIcon fontSize="inherit" />
)}
</IconButton>
</Tooltip>
{/* </Box> */}
}}
onClick={async () => {
killRuntime({
variables: {
sessionId: `${me.id}_${repo.id}`,
},
});
}}
>
{killing ? (
<CircularProgress size="14px" />
) : (
<StopCircleIcon fontSize="inherit" />
)}
</IconButton>
</Tooltip>
</Box>
</Tooltip>
</Box>
);
Expand Down Expand Up @@ -276,29 +276,27 @@ const RepoCard = ({ repo }) => {
return (
<Card sx={{ minWidth: 275, maxWidth: 275 }}>
<CardContent>
<Typography variant="body1" gutterBottom>
<Stack direction="row" display="flex">
<Link
component={ReactLink}
to={`/repo/${repo.id}`}
sx={{
alignItems: "center",
}}
>
<Stack direction="row" display="inline-flex">
<DescriptionOutlinedIcon
sx={{
marginRight: "5px",
}}
/>
<Box component="span">{repo.name || "Untitled"}</Box>
</Stack>
</Link>
<Box ml="auto">
<StarButton repo={repo} />
</Box>
</Stack>
</Typography>
<Stack direction="row" display="flex">
<Link
component={ReactLink}
to={`/repo/${repo.id}`}
sx={{
alignItems: "center",
}}
>
<Stack direction="row" display="inline-flex">
<DescriptionOutlinedIcon
sx={{
marginRight: "5px",
}}
/>
<Box component="span">{repo.name || "Untitled"}</Box>
</Stack>
</Link>
<Box ml="auto">
<StarButton repo={repo} />
</Box>
</Stack>
<Typography variant="subtitle2" color="gray">
<Stack direction="row">
Viewed{" "}
Expand Down Expand Up @@ -410,7 +408,7 @@ const RepoLists = () => {
)}
<Box display="flex" flexWrap="wrap">
{repos.map((repo) => (
<Box sx={{ m: 1 }}>
<Box sx={{ m: 1 }} key={repo.id}>
<RepoCard repo={repo} />
</Box>
))}
Expand Down