diff --git a/apps/expo/src/components/pages/fissa/Tracks.tsx b/apps/expo/src/components/pages/fissa/Tracks.tsx
index 37d067e..7943a75 100644
--- a/apps/expo/src/components/pages/fissa/Tracks.tsx
+++ b/apps/expo/src/components/pages/fissa/Tracks.tsx
@@ -1,6 +1,6 @@
-import { FC, useCallback, useEffect, useMemo, useRef, useState } from "react";
-import { Animated, NativeScrollEvent, NativeSyntheticEvent, View } from "react-native";
-import { FlashList } from "@shopify/flash-list";
+import { useCallback, useEffect, useMemo, useRef, useState, type FC } from "react";
+import { Animated, View, type NativeScrollEvent, type NativeSyntheticEvent } from "react-native";
+import { type FlashList } from "@shopify/flash-list";
import { useGetFissa, useIsOwner } from "@fissa/hooks";
import { sortFissaTracksOrder, useDevices, useTracks } from "@fissa/utils";
@@ -50,12 +50,15 @@ export const FissaTracks: FC<{ pin: string }> = ({ pin }) => {
[data?.currentlyPlayingId, localTracks],
);
- const shouldShowBackButton = useCallback((showShow = false) => {
- Animated.spring(showBackAnimation, {
- toValue: Number(showShow),
- useNativeDriver: false,
- }).start();
- }, []);
+ const shouldShowBackButton = useCallback(
+ (showShow = false) => {
+ Animated.spring(showBackAnimation, {
+ toValue: Number(showShow),
+ useNativeDriver: false,
+ }).start();
+ },
+ [showBackAnimation],
+ );
const getTrackVotes = useCallback(
(track?: SpotifyApi.TrackObjectFull) => {
@@ -68,7 +71,7 @@ export const FissaTracks: FC<{ pin: string }> = ({ pin }) => {
return localTrack.score;
},
- [data?.tracks, data?.currentlyPlayingId, localTracks],
+ [data?.tracks, data?.currentlyPlayingId],
);
const trackEnd = useCallback(
@@ -86,7 +89,7 @@ export const FissaTracks: FC<{ pin: string }> = ({ pin }) => {
return ;
},
- [data?.tracks, data?.currentlyPlayingId, localTracks, isOwner],
+ [data?.tracks, data?.currentlyPlayingId, isOwner, pin],
);
const trackExtra = useCallback(
diff --git a/apps/expo/src/components/pages/fissa/quickVote/QuickVoteContext.tsx b/apps/expo/src/components/pages/fissa/quickVote/QuickVoteContext.tsx
index 5f1fc2a..3875c83 100644
--- a/apps/expo/src/components/pages/fissa/quickVote/QuickVoteContext.tsx
+++ b/apps/expo/src/components/pages/fissa/quickVote/QuickVoteContext.tsx
@@ -1,6 +1,7 @@
import {
createContext,
useCallback,
+ useMemo,
useRef,
useState,
type FC,
@@ -12,8 +13,12 @@ import { impactAsync } from "expo-haptics";
export const QuickVoteContext = createContext({
track: undefined as SpotifyApi.TrackObjectFull | undefined,
vote: 0,
- setVote: (vote: number) => {},
- selectTrack: (event: GestureResponderEvent, track?: SpotifyApi.TrackObjectFull) => {},
+ setVote: (vote: number): void => {
+ console.log("setVote", vote);
+ },
+ selectTrack: (event: GestureResponderEvent, track?: SpotifyApi.TrackObjectFull): void => {
+ console.log("selectTrack", event, track);
+ },
touchStartPosition: {
current: 0,
},
@@ -47,17 +52,16 @@ export const QuickVoteProvider: FC = ({ children }) => {
[],
);
- return (
-
- {children}
-
+ const contextValue = useMemo(
+ () => ({
+ track,
+ vote,
+ setVote: handleSetVote,
+ selectTrack: handleSelectTrack,
+ touchStartPosition,
+ }),
+ [track, vote, handleSetVote, handleSelectTrack, touchStartPosition],
);
+
+ return {children};
};
diff --git a/apps/expo/src/components/shared/Badge.tsx b/apps/expo/src/components/shared/Badge.tsx
index ba1bd0a..81dc9c1 100644
--- a/apps/expo/src/components/shared/Badge.tsx
+++ b/apps/expo/src/components/shared/Badge.tsx
@@ -40,7 +40,7 @@ export const Badge: FC = ({ amount, inverted }) => {
animation.reset();
amountRef.current = amount;
});
- }, [amount]);
+ }, [amount, amountAnimation]);
if (amount === undefined) return null;
diff --git a/apps/expo/src/providers/SpotifyProvider.tsx b/apps/expo/src/providers/SpotifyProvider.tsx
index 19aecf5..59508c3 100644
--- a/apps/expo/src/providers/SpotifyProvider.tsx
+++ b/apps/expo/src/providers/SpotifyProvider.tsx
@@ -3,6 +3,7 @@ import {
createContext,
useCallback,
useContext,
+ useEffect,
useMemo,
useRef,
useState,
@@ -132,21 +133,26 @@ export const SpotifyProvider: FC = ({ children }) => {
await mutateAsync({ code, redirectUri });
}, [response, request, saveScopes, saveTokens]);
- useMemo(async () => {
+ useEffect(() => {
if (user) return;
- const localScopes = await getScopes();
-
- if (String(localScopes) !== scopes.join("_")) return;
+ getScopes()
+ .then((localScopes) => {
+ if (String(localScopes) !== scopes.join("_")) return;
- await updateTokens();
+ updateTokens().catch(console.info);
+ })
+ .catch(console.info);
}, [updateTokens, user, getScopes]);
- useOnActiveApp(async () => {
+ useOnActiveApp(() => {
const { current } = lastTokenSaveTime;
const difference = differenceInMinutes(new Date(), current);
- if (difference < REFRESH_INTERVAL_MINUTES) return;
- await updateTokens();
+ if (difference < REFRESH_INTERVAL_MINUTES) {
+ return;
+ }
+
+ updateTokens().catch(console.info);
});
useInterval(() => {