@@ -3,13 +3,14 @@ import '@tremor/react/dist/esm/tremor.css';
33import { Icon as BpIcon , NonIdealState , Position , Spinner , SpinnerSize } from '@blueprintjs/core' ;
44import { IconNames } from '@blueprintjs/icons' ;
55import { Button , Card , Flex , Text , Title } from '@tremor/react' ;
6- import React , { useCallback , useState } from 'react' ;
6+ import React , { useCallback , useEffect , useState } from 'react' ;
77import { useDispatch } from 'react-redux' ;
88import { Navigate , useParams } from 'react-router' ;
99import { fetchGradingOverviews } from 'src/commons/application/actions/SessionActions' ;
1010import { Role } from 'src/commons/application/ApplicationTypes' ;
1111import SimpleDropdown from 'src/commons/SimpleDropdown' ;
12- import { useSession } from 'src/commons/utils/Hooks' ;
12+ import { useSession , useTypedSelector } from 'src/commons/utils/Hooks' ;
13+ import { updateRequestCounter } from 'src/commons/workspace/WorkspaceActions' ;
1314import { numberRegExp } from 'src/features/academy/AcademyTypes' ;
1415import {
1516 exportGradingCSV ,
@@ -50,8 +51,12 @@ const Grading: React.FC = () => {
5051 const [ showAllSubmissions , setShowAllSubmissions ] = useState ( false ) ;
5152
5253 const dispatch = useDispatch ( ) ;
54+ const requestCounter = useTypedSelector ( state => state . workspaces . grading . requestCounter ) ;
55+
5356 const updateGradingOverviewsCallback = useCallback (
5457 ( page : number , filterParams : Object ) => {
58+ console . log ( "+1 parent" ) ;
59+ dispatch ( updateRequestCounter ( requestCounter + 1 ) ) ;
5560 dispatch (
5661 fetchGradingOverviews (
5762 showAllGroups ,
@@ -64,6 +69,10 @@ const Grading: React.FC = () => {
6469 [ dispatch , showAllGroups , showAllSubmissions , pageSize ]
6570 ) ;
6671
72+ useEffect ( ( ) => {
73+ dispatch ( updateRequestCounter ( Math . max ( 0 , requestCounter - 1 ) ) ) ;
74+ } , [ gradingOverviews ] ) ;
75+
6776 // If submissionId or questionId is defined but not numeric, redirect back to the Grading overviews page
6877 if (
6978 ( params . submissionId && ! params . submissionId ?. match ( numberRegExp ) ) ||
0 commit comments