Skip to content

Commit

Permalink
fix(mfi-v2-ui): disable mobile autoconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
losman0s committed Oct 6, 2023
1 parent 6101fa0 commit 7ca0bc1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/marginfi-v2-ui/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { useMrgnlendStore, useUiStore } from "~/store";
import { useLstStore } from "./stake";
import { WalletModalProvider } from "@solana/wallet-adapter-react-ui";
import { WALLET_ADAPTERS } from "~/config/wallets";
import { useMediaQuery } from "react-responsive";

// Use require instead of import since order matters
require("@solana/wallet-adapter-react-ui/styles.css");
Expand Down Expand Up @@ -63,6 +64,8 @@ const MyApp = ({ Component, pageProps }: AppProps) => {
setIsFetchingData,
]);

const isMobile = useMediaQuery({ query: '(max-width: 640px)' })

const [ready, setReady] = useState(false);

useEffect(() => {
Expand All @@ -80,7 +83,7 @@ const MyApp = ({ Component, pageProps }: AppProps) => {
</Head>
{ready && (
<ConnectionProvider endpoint={config.rpcEndpoint}>
<WalletProvider wallets={WALLET_ADAPTERS} autoConnect>
<WalletProvider wallets={WALLET_ADAPTERS} autoConnect={!isMobile}>
<Desktop>
<WalletModalProvider>
<DesktopNavbar />
Expand Down

0 comments on commit 7ca0bc1

Please sign in to comment.