-
-
Notifications
You must be signed in to change notification settings - Fork 355
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- JS instead of TS - Remove unused npm packages - Remove page layout + logo - Move Apollo Client instantiation out of `hydrate()`
- Loading branch information
1 parent
0ba2782
commit 0243908
Showing
20 changed files
with
72 additions
and
1,032 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const { testPages } = require("../.testPages"); | ||
testPages("react", "npm run start"); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const { testPages } = require("../.testPages"); | ||
testPages("react", "npm run prod"); |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from "react"; | ||
import { ApolloProvider } from "@apollo/client"; | ||
import './App.css'; | ||
|
||
export default App | ||
|
||
function App({ client, children }) { | ||
return ( | ||
<ApolloProvider client={client}> | ||
{children} | ||
</ApolloProvider> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
18 changes: 10 additions & 8 deletions
18
...o/pages/_default/_default.page.client.tsx → ...o/pages/_default/_default.page.client.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
import ReactDOM from "react-dom"; | ||
import React from "react"; | ||
import { getPage } from "vite-plugin-ssr/client"; | ||
import { ApolloClient, InMemoryCache } from '@apollo/client' | ||
import App from '../App'; | ||
import { ApolloClient, InMemoryCache } from "@apollo/client"; | ||
import App from "../App"; | ||
|
||
hydrate(); | ||
|
||
async function hydrate() { | ||
const { Page, pageProps } = await getPage(); | ||
|
||
const client = new ApolloClient({ | ||
uri: 'https://countries.trevorblades.com', | ||
cache: new InMemoryCache().restore(pageProps.initialApolloState), | ||
}); | ||
|
||
ReactDOM.hydrate( | ||
<App client={client}> | ||
<App client={makeApolloClient()}> | ||
<Page {...pageProps} /> | ||
</App> | ||
, document.getElementById("page-content") | ||
); | ||
} | ||
|
||
function makeApolloClient() { | ||
return new ApolloClient({ | ||
uri: "https://countries.trevorblades.com", | ||
cache: new InMemoryCache().restore(pageProps.initialApolloState), | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const reactRefresh = require("@vitejs/plugin-react-refresh"); | ||
const ssr = require("vite-plugin-ssr"); | ||
|
||
const config = { | ||
plugins: [reactRefresh(), ssr()], | ||
clearScreen: false, | ||
}; | ||
|
||
export default config; |
This file was deleted.
Oops, something went wrong.