Commit 9db394ab authored by tom's avatar tom

clean up

parent 26d0abd6
...@@ -15,7 +15,6 @@ import theme from 'theme'; ...@@ -15,7 +15,6 @@ import theme from 'theme';
type Props = { type Props = {
children: React.ReactNode; children: React.ReactNode;
withSocket?: boolean; withSocket?: boolean;
withWeb3?: boolean;
appContext?: { appContext?: {
pageProps: PageProps; pageProps: PageProps;
}; };
...@@ -28,56 +27,47 @@ const defaultAppContext = { ...@@ -28,56 +27,47 @@ const defaultAppContext = {
}, },
}; };
const TestApp = ({ children, withSocket, withWeb3, appContext = defaultAppContext }: Props) => { // >>> Web3 stuff
const [ queryClient ] = React.useState(() => new QueryClient({ const provider = new providers.JsonRpcProvider(
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
retry: 0,
},
},
}));
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const [ wagmiClient ] = React.useState<any>(() => {
if (!withWeb3) {
return;
}
const provider = new providers.JsonRpcProvider(
'http://localhost:8545', 'http://localhost:8545',
{ {
name: 'POA', name: 'POA',
chainId: 99, chainId: 99,
}, },
); );
const connector = new MockConnector({ const connector = new MockConnector({
chains: [ mainnet ], chains: [ mainnet ],
options: { options: {
signer: provider.getSigner(), signer: provider.getSigner(),
}, },
}); });
return createClient({ const wagmiClient = createClient({
autoConnect: true, autoConnect: true,
connectors: [ connector ], connectors: [ connector ],
provider, provider,
}); });
}); // <<<<
const content = wagmiClient ? ( const TestApp = ({ children, withSocket, appContext = defaultAppContext }: Props) => {
<WagmiConfig client={ wagmiClient }> const [ queryClient ] = React.useState(() => new QueryClient({
{ children } defaultOptions: {
</WagmiConfig> queries: {
) : children; refetchOnWindowFocus: false,
retry: 0,
},
},
}));
return ( return (
<ChakraProvider theme={ theme }> <ChakraProvider theme={ theme }>
<QueryClientProvider client={ queryClient }> <QueryClientProvider client={ queryClient }>
<SocketProvider url={ withSocket ? `ws://localhost:${ PORT }` : undefined }> <SocketProvider url={ withSocket ? `ws://localhost:${ PORT }` : undefined }>
<AppContextProvider { ...appContext }> <AppContextProvider { ...appContext }>
{ content } <WagmiConfig client={ wagmiClient }>
{ children }
</WagmiConfig>
</AppContextProvider> </AppContextProvider>
</SocketProvider> </SocketProvider>
</QueryClientProvider> </QueryClientProvider>
......
// running this test together with other causing JS memory leak
// I was not able to figure out the exact reason, so for now it is skipped
import { test, expect } from '@playwright/experimental-ct-react'; import { test, expect } from '@playwright/experimental-ct-react';
import React from 'react'; import React from 'react';
......
...@@ -27,7 +27,7 @@ test('base view +@mobile +@dark-mode', async({ mount, page }) => { ...@@ -27,7 +27,7 @@ test('base view +@mobile +@dark-mode', async({ mount, page }) => {
})); }));
const component = await mount( const component = await mount(
<TestApp withWeb3> <TestApp>
<ContractRead/> <ContractRead/>
</TestApp>, </TestApp>,
{ hooksConfig }, { hooksConfig },
...@@ -56,7 +56,7 @@ test('error result', async({ mount, page }) => { ...@@ -56,7 +56,7 @@ test('error result', async({ mount, page }) => {
})); }));
const component = await mount( const component = await mount(
<TestApp withWeb3> <TestApp>
<ContractRead/> <ContractRead/>
</TestApp>, </TestApp>,
{ hooksConfig }, { hooksConfig },
......
...@@ -22,7 +22,7 @@ test('base view +@mobile', async({ mount, page }) => { ...@@ -22,7 +22,7 @@ test('base view +@mobile', async({ mount, page }) => {
})); }));
const component = await mount( const component = await mount(
<TestApp withWeb3> <TestApp>
<ContractWrite/> <ContractWrite/>
</TestApp>, </TestApp>,
{ hooksConfig }, { hooksConfig },
......
...@@ -7096,7 +7096,7 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: ...@@ -7096,7 +7096,7 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3:
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==
fast-glob@^3.2.12, fast-glob@^3.2.9: fast-glob@^3.2.9:
version "3.2.12" version "3.2.12"
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80"
integrity sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w== integrity sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==
...@@ -11028,13 +11028,6 @@ valtio@1.8.2: ...@@ -11028,13 +11028,6 @@ valtio@1.8.2:
proxy-compare "2.4.0" proxy-compare "2.4.0"
use-sync-external-store "1.2.0" use-sync-external-store "1.2.0"
vite-plugin-dynamic-import@^1.2.6:
version "1.2.6"
resolved "https://registry.yarnpkg.com/vite-plugin-dynamic-import/-/vite-plugin-dynamic-import-1.2.6.tgz#0e4ff699d4e97cdff3ccf9e979957167bc22654b"
integrity sha512-HeO5GsQfsiGfFDLhFOUZeqjM4Y8Xk5ctfRfkw5qLszZT5+N37mMbwqp8TqYxXZ4dd0EBnQ9Zg4Pr5mR2eE9hBA==
dependencies:
fast-glob "^3.2.12"
vite-plugin-svgr@^2.2.2: vite-plugin-svgr@^2.2.2:
version "2.2.2" version "2.2.2"
resolved "https://registry.yarnpkg.com/vite-plugin-svgr/-/vite-plugin-svgr-2.2.2.tgz#c5c9cb573bf455bb079550531847ddc5d2e122af" resolved "https://registry.yarnpkg.com/vite-plugin-svgr/-/vite-plugin-svgr-2.2.2.tgz#c5c9cb573bf455bb079550531847ddc5d2e122af"
...@@ -11043,11 +11036,6 @@ vite-plugin-svgr@^2.2.2: ...@@ -11043,11 +11036,6 @@ vite-plugin-svgr@^2.2.2:
"@rollup/pluginutils" "^5.0.0" "@rollup/pluginutils" "^5.0.0"
"@svgr/core" "^6.4.0" "@svgr/core" "^6.4.0"
vite-plugin-utils@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/vite-plugin-utils/-/vite-plugin-utils-0.4.0.tgz#8f08acb4501efbee53156bcf63ad40da205a826a"
integrity sha512-UZ9hkvRtKXIvQdjozVhUvD+/f2LOoEw3VbJBCWOvchKlzmjGrNULc4ZA/gfpedtjxjxq2tO6WBhrwtoevLnIWg==
vite-tsconfig-paths@^3.5.2: vite-tsconfig-paths@^3.5.2:
version "3.5.2" version "3.5.2"
resolved "https://registry.yarnpkg.com/vite-tsconfig-paths/-/vite-tsconfig-paths-3.5.2.tgz#fd3232f93c426311d7e0d581187d8b63fff55fbc" resolved "https://registry.yarnpkg.com/vite-tsconfig-paths/-/vite-tsconfig-paths-3.5.2.tgz#fd3232f93c426311d7e0d581187d8b63fff55fbc"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment