File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
web/src/pages/Cases/CaseDetails/MaintenanceButtons Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -61,14 +61,9 @@ const MaintenanceButtons: React.FC = () => {
61
61
// using interval here instead of useMemo with dispute, since we can't tell when period has timed out,
62
62
// we can use useCountdown, but that would trigger the update every 1 sec. so this is ideal.
63
63
useEffect ( ( ) => {
64
- const intervalId = setInterval ( ( ) => {
64
+ const rippleCheck = ( ) => {
65
65
if ( ! dispute ) return ;
66
66
67
- if ( dispute . ruled ) {
68
- clearInterval ( intervalId ) ;
69
- return ;
70
- }
71
-
72
67
const period = Periods [ dispute ?. period ] ?? 0 ;
73
68
const now = Date . now ( ) / 1000 ;
74
69
@@ -82,6 +77,19 @@ const MaintenanceButtons: React.FC = () => {
82
77
}
83
78
84
79
setDisplayRipple ( false ) ;
80
+ } ;
81
+
82
+ // initial check
83
+ rippleCheck ( ) ;
84
+
85
+ const intervalId = setInterval ( ( ) => {
86
+ if ( ! dispute ) return ;
87
+
88
+ if ( dispute . ruled ) {
89
+ clearInterval ( intervalId ) ;
90
+ return ;
91
+ }
92
+ rippleCheck ( ) ;
85
93
} , 5000 ) ;
86
94
87
95
return ( ) => clearInterval ( intervalId ) ;
You can’t perform that action at this time.
0 commit comments