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
@@ -1,18 +1,18 @@
import { PencilSquare } from "@medusajs/icons" import { PencilSquare } from "@medusajs/icons"
import { AdminStore } from "@medusajs/types"
import { Badge, Container, Heading, Text } from "@medusajs/ui" import { Badge, Container, Heading, Text } from "@medusajs/ui"
import { useTranslation } from "react-i18next" import { useTranslation } from "react-i18next"
import { ActionMenu } from "../../../../../components/common/action-menu" import { ActionMenu } from "../../../../../components/common/action-menu"
import { useRegion } from "../../../../../hooks/api/regions" import { useRegion } from "../../../../../hooks/api/regions"
import { ExtendedStoreDTO } from "../../../../../types/api-responses"
type StoreGeneralSectionProps = { type StoreGeneralSectionProps = {
store: ExtendedStoreDTO store: AdminStore
} }
export const StoreGeneralSection = ({ store }: StoreGeneralSectionProps) => { export const StoreGeneralSection = ({ store }: StoreGeneralSectionProps) => {
const { t } = useTranslation() const { t } = useTranslation()
const { region } = useRegion(store.default_region_id, undefined, { const { region } = useRegion(store.default_region_id!, undefined, {
enabled: !!store.default_region_id, enabled: !!store.default_region_id,
}) })
@@ -56,10 +56,10 @@ export const StoreGeneralSection = ({ store }: StoreGeneralSectionProps) => {
{defaultCurrency ? ( {defaultCurrency ? (
<div className="flex items-center gap-x-2"> <div className="flex items-center gap-x-2">
<Badge size="2xsmall"> <Badge size="2xsmall">
{defaultCurrency.currency_code.toUpperCase()} {defaultCurrency.currency_code?.toUpperCase()}
</Badge> </Badge>
<Text size="small" leading="compact"> <Text size="small" leading="compact">
{defaultCurrency.currency.name} {defaultCurrency.currency?.name}
</Text> </Text>
</div> </div>
) : ( ) : (
@@ -87,6 +87,7 @@ export class RemoteQuery {
select?: string[] select?: string[]
relations: string[] relations: string[]
args: JoinerArgument args: JoinerArgument
take?: number | null
} { } {
expand = JSON.parse(JSON.stringify(expand)) 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) const result = await service[methodName](filters, options)
if (hasPagination) { if (hasPagination) {