fix(history,workout-builder): memoize async load functions with useCallback
This commit is contained in:
@@ -27,15 +27,15 @@ export function HistoryScreen() {
|
||||
const [sessions, setSessions] = useState<SessionRow[]>([]);
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
|
||||
const loadSessions = async () => {
|
||||
const loadSessions = useCallback(async () => {
|
||||
const data = await getAllSessions();
|
||||
setSessions(data as SessionRow[]);
|
||||
};
|
||||
}, []);
|
||||
|
||||
useFocusEffect(
|
||||
useCallback(() => {
|
||||
loadSessions();
|
||||
}, [])
|
||||
}, [loadSessions])
|
||||
);
|
||||
|
||||
const onRefresh = async () => {
|
||||
|
||||
Reference in New Issue
Block a user