From 28f6f6cf02bbecfae23028445105b6ed9d39c7eb Mon Sep 17 00:00:00 2001 From: Justin Wyne <1986068+wyne@users.noreply.github.com> Date: Sun, 21 Apr 2024 15:34:45 -0700 Subject: [PATCH] cleanup --- src/components/ScoreLog/RoundScoreColumn.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/ScoreLog/RoundScoreColumn.tsx b/src/components/ScoreLog/RoundScoreColumn.tsx index ae588f05..2a696e34 100644 --- a/src/components/ScoreLog/RoundScoreColumn.tsx +++ b/src/components/ScoreLog/RoundScoreColumn.tsx @@ -3,11 +3,12 @@ import React, { memo, useCallback } from 'react'; import analytics from '@react-native-firebase/analytics'; import { LayoutChangeEvent, Text, TouchableWithoutFeedback, View } from 'react-native'; -import { selectSortSelectorKey, updateGame } from '../../../redux/GamesSlice'; +import { updateGame } from '../../../redux/GamesSlice'; import { useAppDispatch, useAppSelector } from '../../../redux/hooks'; +import { selectCurrentGame } from '../../../redux/selectors'; import RoundScoreCell from './RoundScoreCell'; -import { sortSelectors } from './SortHelper'; +import { SortSelectorKey, sortSelectors } from './SortHelper'; interface Props { round: number; @@ -24,11 +25,9 @@ const RoundScoreColumn: React.FunctionComponent = ({ }) => { const dispatch = useAppDispatch(); - const currentGameId = useAppSelector(state => state.settings.currentGameId); - - const sortSelectorKey = useAppSelector(state => selectSortSelectorKey(state, currentGameId || '')); - const sortSelector = sortSelectors[sortSelectorKey]; - + const currentGameId = useAppSelector(state => selectCurrentGame(state)?.id); + const sortKey = useAppSelector(state => selectCurrentGame(state)?.sortSelectorKey); + const sortSelector = sortSelectors[sortKey || SortSelectorKey.ByIndex]; const sortedPlayerIds = useAppSelector(sortSelector); const onPressHandler = useCallback(async () => {