Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 11 additions & 9 deletions frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,18 @@ import RepoIssues from './components/RepoIssues';
import ControlledCarousel from './components/ControlledCarousel';

class App extends Component {
constructor(props) {
super(props);
// Create Apollo Client once for '/donate' route
this.donateClient = new ApolloClient({
link: new HttpLink({ uri: '/graphql' }),
cache: new InMemoryCache(),
});
}

render() {
// Default props
const {
forceRefresh = true,
routes = [
{ path: '/', exact: true, component: Home },
{ path: '/about', exact: true, component: About },
Expand All @@ -29,14 +37,8 @@ class App extends Component {
]
} = this.props;

// Create Apollo Client for '/donate' route
const donateClient = new ApolloClient({
link: new HttpLink({ uri: '/graphql' }),
cache: new InMemoryCache(),
});

return (
<Router forceRefresh={forceRefresh}>
<Router>
<Routes>
{routes.map((route, index) => {
// Wrap the Donate component with ApolloProvider
Expand All @@ -47,7 +49,7 @@ class App extends Component {
path={route.path}
{...(route.exact ? { exact: true } : {})}
element={
<ApolloProvider client={donateClient}>
<ApolloProvider client={this.donateClient}>
<Donate />
</ApolloProvider>
}
Expand Down
Loading