Skip to content

Commit 3581e06

Browse files
fix(remote): keep host start-state in sync with participant claims via polling fallback
1 parent 7ec5c9e commit 3581e06

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

App.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,30 @@ const App: React.FC = () => {
227227
};
228228
}, [isRemote, isConnected]);
229229

230+
useEffect(() => {
231+
if (!isRemote || !isConnected) return;
232+
233+
let timer: number | null = null;
234+
235+
const refreshClaims = async () => {
236+
try {
237+
const claimed = await syncService.listClaimedParticipants();
238+
setClaimedIds(claimed);
239+
} catch {
240+
// Realtime callback remains primary; this is just a resilience fallback.
241+
}
242+
};
243+
244+
void refreshClaims();
245+
timer = window.setInterval(() => {
246+
void refreshClaims();
247+
}, 2000);
248+
249+
return () => {
250+
if (timer) window.clearInterval(timer);
251+
};
252+
}, [isRemote, isConnected]);
253+
230254
const applySetup = async () => {
231255
const nextConfig: AuctionConfig = {
232256
startPrice: Math.max(1, Math.floor(draftConfig.startPrice)),

0 commit comments

Comments
 (0)