From 78a4bcc700b414925fd396561b4b7315e0772db3 Mon Sep 17 00:00:00 2001 From: Riqwan Thamir Date: Thu, 4 Jul 2024 09:37:36 +0200 Subject: [PATCH] fix(dashboard): breaking store page due to default currency (#7915) * chore: fix breaking store page due to default currency * fix: remote query checks all data when scoped by id * chore: minor change --- .../store-general-section/store-general-section.tsx | 10 +++++----- packages/core/modules-sdk/src/remote-query.ts | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/admin-next/dashboard/src/routes/store/store-detail/components/store-general-section/store-general-section.tsx b/packages/admin-next/dashboard/src/routes/store/store-detail/components/store-general-section/store-general-section.tsx index 55320335af..520f817a41 100644 --- a/packages/admin-next/dashboard/src/routes/store/store-detail/components/store-general-section/store-general-section.tsx +++ b/packages/admin-next/dashboard/src/routes/store/store-detail/components/store-general-section/store-general-section.tsx @@ -1,18 +1,18 @@ import { PencilSquare } from "@medusajs/icons" +import { AdminStore } from "@medusajs/types" import { Badge, Container, Heading, Text } from "@medusajs/ui" import { useTranslation } from "react-i18next" import { ActionMenu } from "../../../../../components/common/action-menu" import { useRegion } from "../../../../../hooks/api/regions" -import { ExtendedStoreDTO } from "../../../../../types/api-responses" type StoreGeneralSectionProps = { - store: ExtendedStoreDTO + store: AdminStore } export const StoreGeneralSection = ({ store }: StoreGeneralSectionProps) => { const { t } = useTranslation() - const { region } = useRegion(store.default_region_id, undefined, { + const { region } = useRegion(store.default_region_id!, undefined, { enabled: !!store.default_region_id, }) @@ -56,10 +56,10 @@ export const StoreGeneralSection = ({ store }: StoreGeneralSectionProps) => { {defaultCurrency ? (
- {defaultCurrency.currency_code.toUpperCase()} + {defaultCurrency.currency_code?.toUpperCase()} - {defaultCurrency.currency.name} + {defaultCurrency.currency?.name}
) : ( diff --git a/packages/core/modules-sdk/src/remote-query.ts b/packages/core/modules-sdk/src/remote-query.ts index 75ab428c5f..9ae5bc107b 100644 --- a/packages/core/modules-sdk/src/remote-query.ts +++ b/packages/core/modules-sdk/src/remote-query.ts @@ -87,6 +87,7 @@ export class RemoteQuery { select?: string[] relations: string[] args: JoinerArgument + take?: number | null } { expand = JSON.parse(JSON.stringify(expand)) @@ -222,6 +223,10 @@ export class RemoteQuery { ) } + if (ids?.length && !hasPagination) { + options.take = null + } + const result = await service[methodName](filters, options) if (hasPagination) {