Get a daily random issue suggestion from any GitHub repository
Related to the change with Medusa Internal Service here: https://github.com/medusajs/medusa/pull/12715/files#diff-4d287d33cf799750dfc3957d3c22d87a5d369ca15bbbc7db29265fc864cedfadL248
Context: all of my medusa-service generated update functions are always returning an array, forcing me to have to check the response myself.
ex:
export const updateThemeStep = createStep(
'update-theme-step',
async (input: UpdateCheckoutThemeWorkflowStepInput, { container }) => {
const themeModuleService: ThemeModuleService = container.resolve(CHECKOUT_THEME_MODULE);
const { channel_id, ...updateThemeData } = input;
const originalTheme = await queryCheckoutTheme({ container, themeId: input.id });
const theme = await themeModuleService.updateCheckoutThemes(updateThemeData);
if (Array.isArray(theme)) return new StepResponse(theme[0], originalTheme);
return new StepResponse(theme, originalTheme);
},
async (originalTheme, { container }) => {
if (!originalTheme) return;
const themeModuleService: ThemeModuleService = container.resolve(CHECKOUT_THEME_MODULE);
await themeModuleService.updateCheckoutThemes(originalTheme);
}
);