Skip to content

Commit

Permalink
Remove unecessary payload wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
twschiller committed Jun 21, 2024
1 parent d20f8b7 commit c79ea3d
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ const ActivateExtensionCard: React.FunctionComponent<{
async (values: FormState, helpers: FormikProps<FormState>) => {
try {
dispatch(
actions.activateStandaloneModDefinition({
standaloneModDefinition: { ...extension, ...values },
}),
actions.activateStandaloneModDefinition({ ...extension, ...values }),
);
notify.success("Activated mod");
dispatch(push("/mods"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,14 +437,14 @@ describe("actions", () => {
} = renderHook(() => useModsPageActions(modViewItem), {
setupRedux(dispatch) {
dispatch(
extensionActions.activateStandaloneModDefinition({
extensionActions.activateStandaloneModDefinition(
standaloneModDefinition,
}),
),
);
dispatch(
extensionActions.activateStandaloneModDefinition({
standaloneModDefinition: standaloneModDefinitionFactory(),
}),
extensionActions.activateStandaloneModDefinition(
standaloneModDefinitionFactory(),
),
);
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ describe("it renders", () => {
setupRedux(dispatch) {
dispatch(authSlice.actions.setAuth(authStateFactory()));
dispatch(
extensionsSlice.actions.activateStandaloneModDefinition({
extensionsSlice.actions.activateStandaloneModDefinition(
standaloneModDefinition,
}),
),
);
dispatch(
modModalsSlice.actions.setShareContext({
Expand All @@ -90,9 +90,9 @@ describe("it renders", () => {
setupRedux(dispatch) {
dispatch(authSlice.actions.setAuth(anonAuth));
dispatch(
extensionsSlice.actions.activateStandaloneModDefinition({
extensionsSlice.actions.activateStandaloneModDefinition(
standaloneModDefinition,
}),
),
);
dispatch(
modModalsSlice.actions.setShareContext({
Expand Down Expand Up @@ -147,9 +147,9 @@ describe("it renders", () => {
setupRedux(dispatch) {
dispatch(authSlice.actions.setAuth(authStateFactory()));
dispatch(
extensionsSlice.actions.activateStandaloneModDefinition({
extensionsSlice.actions.activateStandaloneModDefinition(
standaloneModDefinition,
}),
),
);
dispatch(
sharingAction({
Expand Down
14 changes: 7 additions & 7 deletions src/extensionConsole/pages/mods/utils/useReinstall.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ test("uninstalls mod components", async () => {
} = renderHook(() => useReinstall(), {
setupRedux(dispatch) {
dispatch(
extensionActions.activateStandaloneModDefinition({
extensionActions.activateStandaloneModDefinition(
standaloneModDefinition,
}),
),
);
dispatch(
extensionActions.activateStandaloneModDefinition({
standaloneModDefinition: anotherStandaloneModDefinition,
}),
extensionActions.activateStandaloneModDefinition(
anotherStandaloneModDefinition,
),
);
},
});
Expand Down Expand Up @@ -85,9 +85,9 @@ test("dispatches install recipe action", async () => {
} = renderHook(() => useReinstall(), {
setupRedux(dispatch) {
dispatch(
extensionActions.activateStandaloneModDefinition({
extensionActions.activateStandaloneModDefinition(
standaloneModDefinition,
}),
),
);
},
});
Expand Down
18 changes: 4 additions & 14 deletions src/store/checkAvailableInstalledExtensions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,24 +127,14 @@ describe("checkAvailableInstalledExtensions", () => {
});

store.dispatch(
optionsActions.activateStandaloneModDefinition({
standaloneModDefinition: availableButton,
}),
optionsActions.activateStandaloneModDefinition(availableButton),
);
store.dispatch(
optionsActions.activateStandaloneModDefinition({
standaloneModDefinition: unavailableButton,
}),
optionsActions.activateStandaloneModDefinition(unavailableButton),
);
store.dispatch(optionsActions.activateStandaloneModDefinition(availableQb));
store.dispatch(
optionsActions.activateStandaloneModDefinition({
standaloneModDefinition: availableQb,
}),
);
store.dispatch(
optionsActions.activateStandaloneModDefinition({
standaloneModDefinition: unavailableQb,
}),
optionsActions.activateStandaloneModDefinition(unavailableQb),
);

await store.dispatch(actions.checkAvailableInstalledExtensions());
Expand Down
6 changes: 2 additions & 4 deletions src/store/extensionsSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,9 @@ const extensionsSlice = createSlice({
activateStandaloneModDefinition(
state,
{
payload,
}: PayloadAction<{ standaloneModDefinition: StandaloneModDefinition }>,
payload: standaloneModDefinition,
}: PayloadAction<StandaloneModDefinition>,
) {
const { standaloneModDefinition } = payload;

reportEvent(
Events.MOD_COMPONENT_CLOUD_ACTIVATE,
selectEventData(standaloneModDefinition),
Expand Down

0 comments on commit c79ea3d

Please sign in to comment.