Skip to content

Commit 2846483

Browse files
committed
Update remote repo status correctly on initial load of file view and on push/pull
1 parent fc41b83 commit 2846483

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

src/components/coursemanage/files/files.tsx

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,16 @@ export const Files = (props: IFilesProps) => {
140140
}
141141
}
142142
});
143+
getRemoteStatus(
144+
props.lecture,
145+
props.assignment,
146+
RepoType.SOURCE,
147+
true
148+
).then(status => {
149+
setRepoStatus(
150+
status as 'up_to_date' | 'pull_needed' | 'push_needed' | 'divergent'
151+
);
152+
});
143153

144154
const [srcChangedTimestamp, setSrcChangeTimestamp] = React.useState(
145155
moment().valueOf()
@@ -172,7 +182,7 @@ export const Files = (props: IFilesProps) => {
172182
setSrcChangeTimestamp(modified);
173183
}
174184
}
175-
185+
176186
reloadPage();
177187
openBrowser(
178188
`${lectureBasePath}${lecture.code}/${selectedDir}/${assignment.id}`
@@ -256,7 +266,16 @@ export const Files = (props: IFilesProps) => {
256266
enqueueSnackbar('Successfully Pushed Assignment', {
257267
variant: 'success'
258268
});
259-
reloadPage();
269+
getRemoteStatus(
270+
props.lecture,
271+
props.assignment,
272+
RepoType.SOURCE,
273+
true
274+
).then(status => {
275+
setRepoStatus(
276+
status as 'up_to_date' | 'pull_needed' | 'push_needed' | 'divergent'
277+
);
278+
});
260279
} catch (err) {
261280
if (err instanceof Error) {
262281
enqueueSnackbar('Error Pushing Assignment: ' + err.message, {
@@ -347,7 +366,16 @@ export const Files = (props: IFilesProps) => {
347366
enqueueSnackbar('Successfully Pulled Assignment', {
348367
variant: 'success'
349368
});
350-
reloadPage();
369+
getRemoteStatus(
370+
props.lecture,
371+
props.assignment,
372+
RepoType.SOURCE,
373+
true
374+
).then(status => {
375+
setRepoStatus(
376+
status as 'up_to_date' | 'pull_needed' | 'push_needed' | 'divergent'
377+
);
378+
});
351379
} catch (err) {
352380
if (err instanceof Error) {
353381
enqueueSnackbar('Error Pulling Assignment: ' + err.message, {

0 commit comments

Comments
 (0)