Skip to content

Commit

Permalink
Update remote repo status correctly on initial load of file view and …
Browse files Browse the repository at this point in the history
…on push/pull
  • Loading branch information
meffmadd committed Sep 11, 2024
1 parent fc41b83 commit 2846483
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions src/components/coursemanage/files/files.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,16 @@ export const Files = (props: IFilesProps) => {
}
}
});
getRemoteStatus(
props.lecture,
props.assignment,
RepoType.SOURCE,
true
).then(status => {
setRepoStatus(
status as 'up_to_date' | 'pull_needed' | 'push_needed' | 'divergent'
);
});

const [srcChangedTimestamp, setSrcChangeTimestamp] = React.useState(
moment().valueOf()
Expand Down Expand Up @@ -172,7 +182,7 @@ export const Files = (props: IFilesProps) => {
setSrcChangeTimestamp(modified);
}
}

reloadPage();
openBrowser(
`${lectureBasePath}${lecture.code}/${selectedDir}/${assignment.id}`
Expand Down Expand Up @@ -256,7 +266,16 @@ export const Files = (props: IFilesProps) => {
enqueueSnackbar('Successfully Pushed Assignment', {
variant: 'success'
});
reloadPage();
getRemoteStatus(
props.lecture,
props.assignment,
RepoType.SOURCE,
true
).then(status => {
setRepoStatus(
status as 'up_to_date' | 'pull_needed' | 'push_needed' | 'divergent'
);
});
} catch (err) {
if (err instanceof Error) {
enqueueSnackbar('Error Pushing Assignment: ' + err.message, {
Expand Down Expand Up @@ -347,7 +366,16 @@ export const Files = (props: IFilesProps) => {
enqueueSnackbar('Successfully Pulled Assignment', {
variant: 'success'
});
reloadPage();
getRemoteStatus(
props.lecture,
props.assignment,
RepoType.SOURCE,
true
).then(status => {
setRepoStatus(
status as 'up_to_date' | 'pull_needed' | 'push_needed' | 'divergent'
);
});
} catch (err) {
if (err instanceof Error) {
enqueueSnackbar('Error Pulling Assignment: ' + err.message, {
Expand Down

0 comments on commit 2846483

Please sign in to comment.