Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Haarolean committed Dec 18, 2024
1 parent b8161eb commit f65874a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { Controller, FormProvider, useForm } from 'react-hook-form';
import { useAuthenticate } from 'lib/hooks/api/appConfig';
import AlertIcon from 'components/common/Icons/AlertIcon';
import { useNavigate } from 'react-router-dom';
import { useQueryClient } from '@tanstack/react-query';

import * as S from './BasicSignIn.styled';
import { useQueryClient } from '@tanstack/react-query';

interface FormValues {
username: string;
Expand All @@ -28,7 +28,7 @@ function BasicSignIn() {
if (response.raw.url.includes('error')) {
methods.setError('root', { message: 'error' });
} else {
await client.invalidateQueries({queryKey: ['app', 'info']});
await client.invalidateQueries({ queryKey: ['app', 'info'] });
navigate('/');
}
},
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/contexts/GlobalSettingsContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ export const GlobalSettingsProvider: React.FC<
return;
}

const features = info?.data?.response.enabledFeatures
const features = info?.data?.response.enabledFeatures;

Check failure on line 30 in frontend/src/components/contexts/GlobalSettingsContext.tsx

View workflow job for this annotation

GitHub Actions / build / build-and-test

App › Renders navigation

TypeError: Cannot read properties of undefined (reading 'enabledFeatures') at response (src/components/contexts/GlobalSettingsContext.tsx:30:34) at commitHookEffectListMount (node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom.development.js:23150:26) at commitPassiveMountOnFiber (node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom.development.js:24931:11) at commitPassiveMountEffects_complete (node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom.development.js:24891:9) at commitPassiveMountEffects_begin (node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom.development.js:24878:7) at commitPassiveMountEffects (node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom.development.js:24866:3) at flushPassiveEffectsImpl (node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom.development.js:27039:3) at flushPassiveEffects (node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom.development.js:26984:14) at node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom.development.js:26769:9 at flushActQueue (node_modules/.pnpm/react@18.2.0/node_modules/react/cjs/react.development.js:2667:24) at act (node_modules/.pnpm/react@18.2.0/node_modules/react/cjs/react.development.js:2582:11) at node_modules/.pnpm/@testing-library+react@14.3.1_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/@testing-library/react/dist/act-compat.js:47:25 at renderRoot (node_modules/.pnpm/@testing-library+react@14.3.1_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/@testing-library/react/dist/pure.js:180:26) at render (node_modules/.pnpm/@testing-library+react@14.3.1_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/@testing-library/react/dist/pure.js:271:10) at customRender (src/lib/testHelpers.tsx:136:16) at Object.<anonymous> (src/components/__tests__/App.spec.tsx:30:11)

Check failure on line 30 in frontend/src/components/contexts/GlobalSettingsContext.tsx

View workflow job for this annotation

GitHub Actions / build / build-and-test

App › Renders NavBar

TypeError: Cannot read properties of undefined (reading 'enabledFeatures') at response (src/components/contexts/GlobalSettingsContext.tsx:30:34) at commitHookEffectListMount (node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom.development.js:23150:26) at commitPassiveMountOnFiber (node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom.development.js:24931:11) at commitPassiveMountEffects_complete (node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom.development.js:24891:9) at commitPassiveMountEffects_begin (node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom.development.js:24878:7) at commitPassiveMountEffects (node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom.development.js:24866:3) at flushPassiveEffectsImpl (node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom.development.js:27039:3) at flushPassiveEffects (node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom.development.js:26984:14) at node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom.development.js:26769:9 at flushActQueue (node_modules/.pnpm/react@18.2.0/node_modules/react/cjs/react.development.js:2667:24) at act (node_modules/.pnpm/react@18.2.0/node_modules/react/cjs/react.development.js:2582:11) at node_modules/.pnpm/@testing-library+react@14.3.1_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/@testing-library/react/dist/act-compat.js:47:25 at renderRoot (node_modules/.pnpm/@testing-library+react@14.3.1_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/@testing-library/react/dist/pure.js:180:26) at render (node_modules/.pnpm/@testing-library+react@14.3.1_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/@testing-library/react/dist/pure.js:271:10) at customRender (src/lib/testHelpers.tsx:136:16) at Object.<anonymous> (src/components/__tests__/App.spec.tsx:30:11)

if (features) {
setValue({
hasDynamicConfig: features.includes(
ApplicationInfoEnabledFeaturesEnum.DYNAMIC_CONFIG
),
})
});
}
}, [info.data]);

Expand Down
29 changes: 13 additions & 16 deletions frontend/src/lib/hooks/api/appConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,21 @@ export function useAuthenticate() {
}

export function useAppInfo() {
return useQuery(
['app', 'info'],
async () => {
const data = await appConfig.getApplicationInfoRaw()
return useQuery(['app', 'info'], async () => {
const data = await appConfig.getApplicationInfoRaw();

let response: ApplicationInfo = {}
try {
response = await data.value()
} catch {
response = {}
}
let response: ApplicationInfo = {};
try {
response = await data.value();
} catch {
response = {};
}

return {
redirect: data.raw.url.includes('auth'),
response,
}
},
);
return {
redirect: data.raw.url.includes('auth'),
response,
};
});
}

export function useAppConfig() {
Expand Down

0 comments on commit f65874a

Please sign in to comment.