-
Notifications
You must be signed in to change notification settings - Fork 87
Backend data loading #16587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Backend data loading #16587
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
||
| // Mutation to set selected party | ||
| const { doSetSelectedParty } = useAppMutations(); | ||
| const [sentToMutation, setSentToMutation] = useReactState<IParty | undefined>(undefined); |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 month ago
To fix this problem, simply remove the unused state variable declaration: const [sentToMutation, setSentToMutation] = useReactState<IParty | undefined>(undefined); on line 72. This change removes both the getter and setter since they are not used anywhere in the provided code. No further action, refactoring, or import changes are required as this is a local unused variable, and other surrounding functionality is unaffected.
| @@ -69,7 +69,6 @@ | ||
|
|
||
| // Mutation to set selected party | ||
| const { doSetSelectedParty } = useAppMutations(); | ||
| const [sentToMutation, setSentToMutation] = useReactState<IParty | undefined>(undefined); | ||
| const { | ||
| mutateAsync, | ||
| data: dataFromMutation, |
| const [sentToMutation, setSentToMutation] = useReactState<IParty | undefined>(undefined); | ||
| const { | ||
| mutateAsync, | ||
| data: dataFromMutation, |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 month ago
To fix the problem, remove the unused variable dataFromMutation from the destructuring assignment of the object returned by the useMutation hook. Specifically, on line 75 in the PartySelection component, update the destructuring from:
const { mutateAsync, data: dataFromMutation, error: mutationError } = useMutation({...});
to:
const { mutateAsync, error: mutationError } = useMutation({...});
This change removes the unused element without affecting the functional behavior of the code, since dataFromMutation was never utilized.
| @@ -72,7 +72,6 @@ | ||
| const [sentToMutation, setSentToMutation] = useReactState<IParty | undefined>(undefined); | ||
| const { | ||
| mutateAsync, | ||
| data: dataFromMutation, | ||
| error: mutationError, | ||
| } = useMutation({ | ||
| mutationKey: ['doSetSelectedParty'], |
|
|
||
| const selectedParty = useSelectedParty(); | ||
| const setUserHasSelectedParty = useSetHasSelectedParty(); | ||
| const [userHasSelectedParty, setUserHasSelectedParty] = useReactState(false); |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 month ago
The best way to fix this problem is to remove the unused state variable declaration. Specifically, in file src/App/frontend/src/features/instantiate/containers/PartySelection.tsx, delete the line (line 86) that initializes [userHasSelectedParty, setUserHasSelectedParty] using useReactState(false);. No other changes are needed because the variable is not used elsewhere in the provided code snippet. This ensures the code is cleaner and does not contain unnecessary state.
| @@ -83,7 +83,6 @@ | ||
| }); | ||
|
|
||
| const selectedParty = useSelectedParty(); | ||
| const [userHasSelectedParty, setUserHasSelectedParty] = useReactState(false); | ||
|
|
||
| const appMetadata = useApplicationMetadata(); | ||
|
|
|
|
||
| export function ProcessWrapper({ children }: PropsWithChildren) { | ||
| const { data: process } = useProcessQuery(); | ||
| const currentTaskId = process?.currentTask?.elementId; |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 21 days ago
The correct fix is to delete the unused variable declaration for currentTaskId in the ProcessWrapper function in src/App/frontend/src/components/wrappers/ProcessWrapper.tsx, specifically on line 88. This will make the code more readable and eliminate an unnecessary variable with no impact on existing functionality. No imports or other code sections are affected by this change.
| @@ -85,7 +85,6 @@ | ||
|
|
||
| export function ProcessWrapper({ children }: PropsWithChildren) { | ||
| const { data: process } = useProcessQuery(); | ||
| const currentTaskId = process?.currentTask?.elementId; | ||
|
|
||
| const taskId = useNavigationParam('taskId'); | ||
|
|
Description
This PR implements backend initialization of app data as desribed in this ADR:
Altinn/app-frontend-react#3734
See the ADR for architetcture changes and rationale.
It is part of the larger refactoring work by the Frontend Next Taskforce.
Related issues:
Verification