Skip to content

Commit 4e01f55

Browse files
committed
fix: first connect should no longer stick on authscreen
1 parent 6f3d4c0 commit 4e01f55

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/App.jsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,9 @@ function App() {
459459
needsAuthorizationValue === "1";
460460

461461
setIsSpotifyAuthenticated(isAuthenticated);
462-
setIsSpotifySkipped(isSkipped);
462+
if (skippedValue !== undefined) {
463+
setIsSpotifySkipped(isSkipped);
464+
}
463465
setNeedsSpotifyAuthorization(needsAuthorization);
464466
setAuthStatusMessage(
465467
hasDevices &&
@@ -560,6 +562,20 @@ function App() {
560562
};
561563
}, [wsConnected, appReady]);
562564

565+
useEffect(() => {
566+
if (!showAuthScreen || !appReady || !wsConnected) return;
567+
568+
const interval = setInterval(() => {
569+
sendNocturneWsRequest("spotify.auth.getStatus", {}, { timeoutMs: 5000 })
570+
.then((authResult) => {
571+
processSpotifyAuthMessage(authResult);
572+
})
573+
.catch(() => {});
574+
}, 5000);
575+
576+
return () => clearInterval(interval);
577+
}, [showAuthScreen, appReady, wsConnected, processSpotifyAuthMessage]);
578+
563579
useEffect(() => {
564580
if (isSpotifySkipped) {
565581
setShowAuthScreen(false);

0 commit comments

Comments
 (0)