Skip to content

Commit

Permalink
Try fix build "out of memory" error (#1347)
Browse files Browse the repository at this point in the history
* build: allocate more memory for nodejs on build

* build: increase memory limit

* chore: remove posthog provider to test build error

* chore: remove posthog provider to test build error

* chore: remove reward import

* build: remove memory limit override

* chore: fix circular import

* fix: update import outside v2

* fix: add missing react suspense

* Revert "chore: remove reward import"

This reverts commit b2cf1d8.

* chore: remove accidental svg

* fix(layout): add back `PostHogPageViews`

---------

Co-authored-by: BrickheadJohnny <[email protected]>
  • Loading branch information
dominik-stumpf and BrickheadJohnny authored Jul 3, 2024
1 parent e376372 commit d9e797c
Show file tree
Hide file tree
Showing 30 changed files with 47 additions and 46 deletions.
3 changes: 2 additions & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export default function RootLayout({ children }: RootLayoutProps) {
<body className={clsx(dystopian.variable, inter.variable)}>
<Providers>
{children}
<Suspense fallback={null}>

<Suspense>
<PostHogPageViews />
</Suspense>
</Providers>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { walletSelectorModalAtom } from "@/components/Providers/Providers"
import { walletSelectorModalAtom } from "@/components/Providers/atoms"
import { useWeb3ConnectionManager } from "@/components/Web3ConnectionManager/hooks/useWeb3ConnectionManager"
import { SignIn, Wallet } from "@phosphor-icons/react"
import { useSetAtom } from "jotai"
Expand Down
2 changes: 1 addition & 1 deletion src/components/[guild]/NoPermissionToPageFallback.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
accountModalAtom,
walletSelectorModalAtom,
} from "@/components/Providers/Providers"
} from "@/components/Providers/atoms"
import {
Alert,
AlertDescription,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { accountModalAtom } from "@/components/Providers/Providers"
import { accountModalAtom } from "@/components/Providers/atoms"
import {
Circle,
HStack,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { walletSelectorModalAtom } from "@/components/Providers/Providers"
import { walletSelectorModalAtom } from "@/components/Providers/atoms"
import { useWeb3ConnectionManager } from "@/components/Web3ConnectionManager/hooks/useWeb3ConnectionManager"
import { Collapse, Tooltip } from "@chakra-ui/react"
import Button from "components/common/Button"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { accountModalAtom } from "@/components/Providers/Providers"
import { accountModalAtom } from "@/components/Providers/atoms"
import {
ButtonGroup,
Collapse,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { accountModalAtom } from "@/components/Providers/Providers"
import { accountModalAtom } from "@/components/Providers/atoms"
import {
ButtonGroup,
Icon,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { accountModalAtom } from "@/components/Providers/Providers"
import { accountModalAtom } from "@/components/Providers/atoms"
import {
Box,
Divider,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { walletSelectorModalAtom } from "@/components/Providers/Providers"
import { walletSelectorModalAtom } from "@/components/Providers/atoms"
import { Center, Collapse, Img, useColorModeValue } from "@chakra-ui/react"
import { SignIn, X } from "@phosphor-icons/react"
import ActionCard from "components/common/ActionCard"
Expand Down
2 changes: 1 addition & 1 deletion src/components/_app/LegacyWeb3ConnectionManager.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { walletSelectorModalAtom } from "@/components/Providers/Providers"
import { walletSelectorModalAtom } from "@/components/Providers/atoms"
import { useWeb3ConnectionManager } from "@/components/Web3ConnectionManager/hooks/useWeb3ConnectionManager"
import { Web3ConnectionManagerBase } from "@/components/Web3ConnectionManager/Web3ConnectionManager"
import { useSetAtom } from "jotai"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { accountModalAtom } from "@/components/Providers/Providers"
import { accountModalAtom } from "@/components/Providers/atoms"
import {
ButtonGroup,
GridItem,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { walletSelectorModalAtom } from "@/components/Providers/Providers"
import { walletSelectorModalAtom } from "@/components/Providers/atoms"
import { useWeb3ConnectionManager } from "@/components/Web3ConnectionManager/hooks/useWeb3ConnectionManager"
import { ButtonGroup, Divider } from "@chakra-ui/react"
import { SignIn } from "@phosphor-icons/react"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
addressLinkParamsAtom,
walletSelectorModalAtom,
} from "@/components/Providers/Providers"
} from "@/components/Providers/atoms"
import { useWeb3ConnectionManager } from "@/components/Web3ConnectionManager/hooks/useWeb3ConnectionManager"
import { Plus } from "@phosphor-icons/react"
import useUser from "components/[guild]/hooks/useUser"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { accountModalAtom } from "@/components/Providers/Providers"
import { accountModalAtom } from "@/components/Providers/atoms"
import { Link } from "@chakra-ui/next-js"
import { Card, Circle, Img, Tag, useColorModeValue } from "@chakra-ui/react"
import { useSetAtom } from "jotai"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { accountModalAtom } from "@/components/Providers/Providers"
import { accountModalAtom } from "@/components/Providers/atoms"
import { Alert, AlertIcon, Box, Flex, Text } from "@chakra-ui/react"
import useUsersGuildPins from "hooks/useUsersGuildPins"
import { useAtomValue } from "jotai"
Expand Down
2 changes: 1 addition & 1 deletion src/components/create-guild/CreateGuildButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { walletSelectorModalAtom } from "@/components/Providers/Providers"
import { walletSelectorModalAtom } from "@/components/Providers/atoms"
import { useWeb3ConnectionManager } from "@/components/Web3ConnectionManager/hooks/useWeb3ConnectionManager"
import { Collapse, Stack } from "@chakra-ui/react"
import Button from "components/common/Button"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { walletSelectorModalAtom } from "@/components/Providers/Providers"
import { walletSelectorModalAtom } from "@/components/Providers/atoms"
import { useWeb3ConnectionManager } from "@/components/Web3ConnectionManager/hooks/useWeb3ConnectionManager"
import {
Circle,
Expand Down
2 changes: 1 addition & 1 deletion src/components/explorer/YourGuilds.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { walletSelectorModalAtom } from "@/components/Providers/Providers"
import { walletSelectorModalAtom } from "@/components/Providers/atoms"
import { useWeb3ConnectionManager } from "@/components/Web3ConnectionManager/hooks/useWeb3ConnectionManager"
import { Box, HStack, Img, Stack, Text } from "@chakra-ui/react"
import { Plus, SignIn } from "@phosphor-icons/react"
Expand Down
2 changes: 1 addition & 1 deletion src/v2/components/Account/Account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import useUser from "components/[guild]/hooks/useUser"
import { useSetAtom } from "jotai"
import shortenHex from "utils/shortenHex"
import { GuildAvatar } from "../GuildAvatar"
import { accountModalAtom, walletSelectorModalAtom } from "../Providers/Providers"
import { accountModalAtom, walletSelectorModalAtom } from "../Providers/atoms"
import { Button } from "../ui/Button"
import { Card } from "../ui/Card"
import { useWeb3ConnectionManager } from "../Web3ConnectionManager/hooks/useWeb3ConnectionManager"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CopyableAddress } from "@/components/CopyableAddress"
import { GuildAvatar } from "@/components/GuildAvatar"
import { accountModalAtom } from "@/components/Providers/Providers"
import { accountModalAtom } from "@/components/Providers/atoms"
import { Button } from "@/components/ui/Button"
import {
Dialog,
Expand Down
20 changes: 4 additions & 16 deletions src/v2/components/Providers/Providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import { FuelProvider } from "@fuels/react"
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"
import { fuelConfig } from "fuelConfig"
import { atom } from "jotai"
import { ThemeProvider } from "next-themes"
import { SWRConfig } from "swr"
import { fetcherForSWR } from "utils/fetcher"
Expand All @@ -13,23 +12,10 @@ import { AccountModal } from "../Account/components/AccountModal"
import { Toaster } from "../ui/Toaster"
import { Web3ConnectionManager } from "../Web3ConnectionManager"
import { PostHogProvider } from "./PostHogProvider"
import { Suspense } from "react"

const queryClient = new QueryClient()

// Atoms for global modals - TODO: move the types to another file
export const walletSelectorModalAtom = atom(false)
export const accountModalAtom = atom(false)

export type AddressLinkParams = {
userId?: number
address?: `0x${string}`
}
export const addressLinkParamsAtom = atom<AddressLinkParams>({
userId: undefined,
address: undefined,
})
export const walletLinkHelperModalAtom = atom(false)

// TODO: add AppErrorBoundary
export function Providers({ children }: { children: React.ReactNode }) {
return (
Expand All @@ -48,7 +34,9 @@ export function Providers({ children }: { children: React.ReactNode }) {
{/* TODO: <IntercomProvider> */}
{children}
<AccountModal />
<Web3ConnectionManager />
<Suspense>
<Web3ConnectionManager />
</Suspense>
{/* </IntercomProvider> */}
</PostHogProvider>
</FuelProvider>
Expand Down
10 changes: 10 additions & 0 deletions src/v2/components/Providers/atoms.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { atom } from "jotai"
import { AddressLinkParams } from "./types"

export const accountModalAtom = atom(false)
export const walletSelectorModalAtom = atom(false)
export const addressLinkParamsAtom = atom<AddressLinkParams>({
userId: undefined,
address: undefined,
})
export const walletLinkHelperModalAtom = atom(false)
4 changes: 4 additions & 0 deletions src/v2/components/Providers/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export type AddressLinkParams = {
userId?: number
address?: `0x${string}`
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import LogicDivider from "components/[guild]/LogicDivider"
import Button from "components/common/Button"
import { Modal } from "components/common/Modal"
import { useAtom } from "jotai"
import { walletLinkHelperModalAtom } from "../Providers/Providers"
import { walletLinkHelperModalAtom } from "../Providers/atoms"

const WalletLinkHelperModal = () => {
const [isWalletLinkHelperModalOpen, setIsWalletLinkModalOpen] = useAtom(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { usePostHogContext } from "@/components/Providers/PostHogProvider"
import {
addressLinkParamsAtom,
walletLinkHelperModalAtom,
} from "@/components/Providers/Providers"
} from "@/components/Providers/atoms"
import { useWeb3ConnectionManager } from "@/components/Web3ConnectionManager/hooks/useWeb3ConnectionManager"
import { ArrowSquareOut } from "@phosphor-icons/react/dist/ssr"
import { useAtom, useSetAtom } from "jotai"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
addressLinkParamsAtom,
walletLinkHelperModalAtom,
} from "@/components/Providers/Providers"
} from "@/components/Providers/atoms"
import { Button, ButtonProps } from "@/components/ui/Button"
import useConnectorNameAndIcon from "@/components/Web3ConnectionManager/hooks/useConnectorNameAndIcon"
import { useUserPublic } from "@/hooks/useUserPublic"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { addressLinkParamsAtom } from "@/components/Providers/atoms"
import { usePostHogContext } from "@/components/Providers/PostHogProvider"
import {
AddressLinkParams,
addressLinkParamsAtom,
} from "@/components/Providers/Providers"
import { AddressLinkParams } from "@/components/Providers/types"
import { useWeb3ConnectionManager } from "@/components/Web3ConnectionManager/hooks/useWeb3ConnectionManager"
import { useUserPublic } from "@/hooks/useUserPublic"
import useSubmit from "hooks/useSubmit"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import useAutoReconnect from "@/hooks/useAutoReconnect"
import { useAtom } from "jotai"
import { walletSelectorModalAtom } from "../Providers/Providers"
import { walletSelectorModalAtom } from "../Providers/atoms"
import { useTriggerWalletSelectorModal } from "./hooks/useTriggerWalletSelectorModal"
import WalletSelectorModal from "./WalletSelectorModal"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { walletSelectorModalAtom } from "@/components/Providers/Providers"
import { walletSelectorModalAtom } from "@/components/Providers/atoms"
import { useSetAtom } from "jotai"
import { useSearchParams } from "next/navigation"
import { useEffect } from "react"
Expand Down
2 changes: 1 addition & 1 deletion src/v2/hooks/useUserPublic.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { usePostHogContext } from "@/components/Providers/PostHogProvider"
import { walletSelectorModalAtom } from "@/components/Providers/Providers"
import { walletSelectorModalAtom } from "@/components/Providers/atoms"
import { useToast } from "@/components/ui/hooks/useToast"
import { useWeb3ConnectionManager } from "@/components/Web3ConnectionManager/hooks/useWeb3ConnectionManager"
import { PublicUserProfile } from "@guildxyz/types"
Expand Down

0 comments on commit d9e797c

Please sign in to comment.