()
| 151 | }; |
| 152 | |
| 153 | const pollHealth = async () => { |
| 154 | try { |
| 155 | const isHealthy = await checkHealth(); |
| 156 | if (isHealthy) { |
| 157 | if (!connected) { |
| 158 | setConnected(true); |
| 159 | checkServerVersion(); |
| 160 | checkAutoSync(); |
| 161 | refreshData(); |
| 162 | checkForPendingAction(); |
| 163 | } |
| 164 | } else { |
| 165 | if (connected) { |
| 166 | setConnected(false); |
| 167 | setError('Backend disconnected. Attempting to reconnect...'); |
| 168 | checkedPendingRef.current = false; |
| 169 | } |
| 170 | } |
| 171 | } catch { |
| 172 | if (connected) { |
| 173 | setConnected(false); |
| 174 | setError('Backend connection lost. Check if the server is still running.'); |
| 175 | } |
| 176 | } |
| 177 | }; |
| 178 | |
| 179 | checkServerVersion(); |
| 180 | checkAutoSync(); |
nothing calls this directly
no test coverage detected