Skip to content

Commit

Permalink
Merge branch 'develop' into fix/allocation-checkmark-alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Mar 21, 2023
2 parents c57caa6 + 497c7c5 commit 6c6a9e0
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/heavy-donuts-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/admin-ui": patch
---

fix(admin-ui): Fix location address editing form state
5 changes: 5 additions & 0 deletions .changeset/wicked-cheetahs-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/admin-ui": patch
---

feat(admin-ui): Encode location id in URL on location table
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface InventoryFilterState {
additionalFilters: InventoryDefaultFilters | null
}

const allowedFilters = ["location", "q", "offset", "limit"]
const allowedFilters = ["q", "offset", "limit", "location_id"]

const DefaultTabs = {}

Expand Down Expand Up @@ -226,8 +226,8 @@ export const useInventoryFilters = (
if (value && typeof value === "string") {
toQuery["q"] = value
}
} else if (key === "offset" || key === "limit") {
toQuery[key] = value
} else if (key === "offset" || key === "limit" || key === "location") {
toQuery[stateFilterMap[key] || key] = value
} else if (value.open) {
toQuery[stateFilterMap[key]] = value.filter
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ const AddressForm = ({
required={addressFieldsRequired}
{...register(path("address_1"), {
pattern: FormValidator.whiteSpaceRule("Address 1"),
required: addressFieldsRequired,
required: addressFieldsRequired
? "This field is required"
: undefined,
})}
/>
<InputField
Expand Down Expand Up @@ -113,7 +115,9 @@ const AddressForm = ({
control={control}
name={path("country_code")}
rules={{
required: addressFieldsRequired,
required: addressFieldsRequired
? "This field is required"
: undefined,
}}
render={({ field: { value, onChange } }) => {
let fieldValue:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ const LocationEditModal = ({ onClose, location }: LocationEditModalProps) => {
})
const notification = useNotification()

const { mutate } = useAdminUpdateStockLocation(location.id)
const { mutate, isLoading } = useAdminUpdateStockLocation(location.id)

const { handleSubmit, formState } = form

const { isDirty, isValid } = formState
const { isDirty } = formState

const onSubmit = handleSubmit(async (data) => {
const payload = createPayload(data)
Expand Down Expand Up @@ -85,7 +85,7 @@ const LocationEditModal = ({ onClose, location }: LocationEditModalProps) => {
size="small"
variant="primary"
type="button"
disabled={!isDirty || !isValid}
disabled={!isDirty || isLoading}
onClick={onSubmit}
>
Save and close
Expand Down

0 comments on commit 6c6a9e0

Please sign in to comment.