Skip to content

Commit

Permalink
refactor: merchant categories refresh condition
Browse files Browse the repository at this point in the history
  • Loading branch information
LeleDallas committed Oct 22, 2024
1 parent ea10276 commit b7a4bd7
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { CgnMerchantListSkeleton } from "../../components/merchants/CgnMerchantL
export const CgnMerchantCategoriesListScreen = () => {
const insets = useSafeAreaInsets();
const dispatch = useIODispatch();
const [isRefreshing, setIsRefreshing] = React.useState(false);
const [isPullRefresh, setIsPullRefresh] = React.useState(false);
const potCategories = useIOSelector(cgnCategoriesListSelector);
const isDesignSystemEnabled = useIOSelector(isDesignSystemEnabledSelector);
Expand All @@ -54,7 +53,6 @@ export const CgnMerchantCategoriesListScreen = () => {
});

const loadCategories = () => {
setIsRefreshing(true);
dispatch(cgnCategories.request());
};

Expand All @@ -78,7 +76,6 @@ export const CgnMerchantCategoriesListScreen = () => {

React.useEffect(() => {
if (pot.isSome(potCategories) && !pot.isLoading(potCategories)) {
setIsRefreshing(false);
setIsPullRefresh(false);
}
}, [potCategories]);
Expand Down Expand Up @@ -134,7 +131,7 @@ export const CgnMerchantCategoriesListScreen = () => {
{bottomSheet}
<FlatList
ListEmptyComponent={() => <CgnMerchantListSkeleton hasIcons />}
data={isRefreshing ? [] : categoriesToArray}
data={pot.isNone(potCategories) ? [] : categoriesToArray}
style={[
IOStyles.horizontalContentPadding,
IOStyles.flex,
Expand Down

0 comments on commit b7a4bd7

Please sign in to comment.