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
This commit is contained in:
Riqwan Thamir
2024-07-04 09:37:36 +02:00
committed by GitHub
parent aa0390af4b
commit 78a4bcc700
2 changed files with 10 additions and 5 deletions

View File

@@ -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 ? (
<div className="flex items-center gap-x-2">
<Badge size="2xsmall">
{defaultCurrency.currency_code.toUpperCase()}
{defaultCurrency.currency_code?.toUpperCase()}
</Badge>
<Text size="small" leading="compact">
{defaultCurrency.currency.name}
{defaultCurrency.currency?.name}
</Text>
</div>
) : (

View File

@@ -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) {