Skip to content

Commit

Permalink
feat: enable toggle for react query devtools
Browse files Browse the repository at this point in the history
  • Loading branch information
brobro10000 committed May 22, 2024
1 parent 9f442ff commit 1997acf
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/components/App/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useMemo } from 'react';
import React, { useEffect, useMemo, useState } from 'react';
import {
Route, Navigate, Routes, generatePath, useParams,
} from 'react-router-dom';
Expand Down Expand Up @@ -60,6 +60,11 @@ const AppWrapper = () => {
const apiClient = getAuthenticatedHttpClient();
const config = getConfig();

const [showReactQueryDevtools, setShowReactQueryDevtools] = useState(false);
useEffect(() => {
window.toggleReactQueryDevtools = () => setShowReactQueryDevtools((prevState) => !prevState);

Check warning on line 65 in src/components/App/index.jsx

View check run for this annotation

Codecov / codecov/patch

src/components/App/index.jsx#L63-L65

Added lines #L63 - L65 were not covered by tests
});

useEffect(() => {
if (process.env.HOTJAR_APP_ID) {
try {
Expand Down Expand Up @@ -90,10 +95,11 @@ const AppWrapper = () => {
}
return true;
}, [config]);

const ReactQueryDevtoolsProduction = ReactQueryDevtools;

Check warning on line 98 in src/components/App/index.jsx

View check run for this annotation

Codecov / codecov/patch

src/components/App/index.jsx#L98

Added line #L98 was not covered by tests
return (
<QueryClientProvider client={queryClient}>
<ReactQueryDevtools />
{/* <ReactQueryDevtools /> */}
{showReactQueryDevtools && <ReactQueryDevtoolsProduction />}
<AppProvider store={store}>
<Helmet
titleTemplate="%s - edX Admin Portal"
Expand Down

0 comments on commit 1997acf

Please sign in to comment.