Skip to content

Commit

Permalink
style: revert adding isFetching as already in useAppIsLoading
Browse files Browse the repository at this point in the history
  • Loading branch information
aziolek committed Apr 23, 2024
1 parent 8b43d63 commit 5bc0767
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 19 deletions.
5 changes: 2 additions & 3 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ const App = (): ReactElement => {
const [isFlushRequired, setIsFlushRequired] = useState(false);
const { isSyncingInProgress } = useAppConnectManager(isFlushRequired, setIsFlushRequired);
const isLoading = useAppIsLoading(isFlushRequired);
const { data: isProjectAdminMode, isFetching: isFetchingProjectAdminMode } =
useIsProjectAdminMode();
const isProjectAdminMode = useIsProjectAdminMode();

// useCypressHelpers needs to be called after all the initial sets done above.
const { isFetching: isFetchingCypressHelpers } = useCypressHelpers();

if ((isLoading || isFetchingProjectAdminMode) && !isSyncingInProgress) {
if (isLoading && !isSyncingInProgress) {
return <AppLoader />;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const EarnBoxPersonalAllocation: FC<EarnBoxPersonalAllocationProps> = ({ classNa
}));

const isPreLaunch = getIsPreLaunch(currentEpoch);
const { data: isProjectAdminMode } = useIsProjectAdminMode();
const isProjectAdminMode = useIsProjectAdminMode();

const sections: SectionProps[] = [
...(!isProjectAdminMode
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Earn/EarnHistory/EarnHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const EarnHistory: FC<EarnHistoryProps> = ({ className }) => {

const { data: currentEpoch } = useCurrentEpoch();
const { fetchNextPage, history, hasNextPage, isFetching: isFetchingHistory } = useHistory();
const { data: isProjectAdminMode } = useIsProjectAdminMode();
const isProjectAdminMode = useIsProjectAdminMode();

const isPreLaunch = getIsPreLaunch(currentEpoch);
const showLoader = isFetchingHistory && !isPreLaunch && !history?.length;
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/shared/Layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const Layout: FC<LayoutProps> = ({
const { pathname } = useLocation();
const navigate = useNavigate();
const { data: isUserTOSAccepted } = useUserTOS();
const { data: isProjectAdminMode } = useIsProjectAdminMode();
const isProjectAdminMode = useIsProjectAdminMode();

const isPreLaunch = getIsPreLaunch(currentEpoch);
const isAllocationRoot = !!useMatch(ROOT_ROUTES.allocation.absolute);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const LayoutNavbar: FC<LayoutNavbarProps> = ({ navigationBottomSuffix, tabs }) =
const { isDesktop } = useMediaQuery();
const location = useLocation();
const [scope, animate] = useAnimate();
const { data: isProjectAdminMode } = useIsProjectAdminMode();
const isProjectAdminMode = useIsProjectAdminMode();

const areTabsDisabled = isConnected && !isUserTOSAccepted;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const LayoutWallet: FC<LayoutWalletProps> = ({ onDisconnect }) => {

const { disconnect } = useDisconnect();

const { data: isProjectAdminMode } = useIsProjectAdminMode();
const isProjectAdminMode = useIsProjectAdminMode();

/**
* Setting values in local state prevents flickering
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/shared/TipTile/TipTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const TipTile: React.FC<TipTileProps> = ({
title,
}) => {
const { isDesktop } = useMediaQuery();
const { data: isProjectAdminMode } = useIsProjectAdminMode();
const isProjectAdminMode = useIsProjectAdminMode();
const shouldSkipEntranceAnimation = useRef(isOpen);

return (
Expand Down
12 changes: 5 additions & 7 deletions client/src/hooks/helpers/useIsProjectAdminMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ import { useAccount } from 'wagmi';

import useAllProjects from 'hooks/subgraph/useAllProjects';

const useIsProjectAdminMode = (): { data: boolean; isFetching: boolean } => {
const useIsProjectAdminMode = (): boolean => {
const { isConnected, address } = useAccount();
const { data: allProjects, isFetching: isFetchingAllProjects } = useAllProjects();
const { data: allProjects } = useAllProjects();

return {
data:
isConnected && !!address && !!allProjects?.includes(address.toLowerCase() as `0x${string}`),
isFetching: isFetchingAllProjects,
};
return (
isConnected && !!address && !!allProjects?.includes(address.toLowerCase() as `0x${string}`)
);
};

export default useIsProjectAdminMode;
2 changes: 1 addition & 1 deletion client/src/routes/RootRoutes/RootRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Protected: FC<ProtectedProps> = ({ children, isSyncingInProgress }) =>
const RootRoutes: FC<RootRoutesProps> = props => {
const { data: currentEpoch } = useCurrentEpoch();
const isPreLaunch = getIsPreLaunch(currentEpoch);
const { data: isProjectAdminMode } = useIsProjectAdminMode();
const isProjectAdminMode = useIsProjectAdminMode();
const { data: isPatronMode } = useIsPatronMode();

return (
Expand Down
2 changes: 1 addition & 1 deletion client/src/views/EarnView/EarnView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const EarnView = (): ReactElement => {
refetchInterval: isPollingForCurrentEpoch ? 5000 : false,
});

const { data: isProjectAdminMode } = useIsProjectAdminMode();
const isProjectAdminMode = useIsProjectAdminMode();

useEffect(() => {
// When Epoch 0 ends, we poll for Epoch 1 from the backend.
Expand Down
2 changes: 1 addition & 1 deletion client/src/views/SettingsView/SettingsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const SettingsView = (): ReactElement => {
const { isDesktop } = useMediaQuery();
const { isConnected } = useAccount();

const { data: isProjectAdminMode } = useIsProjectAdminMode();
const isProjectAdminMode = useIsProjectAdminMode();

return (
<Layout dataTest="SettingsView">
Expand Down

0 comments on commit 5bc0767

Please sign in to comment.