diff --git a/app/components/form/WoW/OutOfStockForm/index.tsx b/app/components/form/WoW/OutOfStockForm/index.tsx
index d2a1d5d4..424a9ffd 100644
--- a/app/components/form/WoW/OutOfStockForm/index.tsx
+++ b/app/components/form/WoW/OutOfStockForm/index.tsx
@@ -14,13 +14,32 @@ const OutOfStockForm = ({
const parseCategories = (value: string | number | number[]): number[] => {
if (Array.isArray(value)) return value
if (typeof value === 'string' && value.trim() !== '') {
- return value.split(',').map(Number).filter(n => !isNaN(n))
+ return value
+ .split(',')
+ .map(Number)
+ .filter((n) => !isNaN(n))
}
return []
}
return (
+ onFormChange('expansionNumber', value)}
+ />
+
+
onFormChange('rankingWP', e.target.value)}
/>
- onFormChange('expansionNumber', value)}
- />
-
-
)
}
-export default OutOfStockForm
\ No newline at end of file
+export default OutOfStockForm
diff --git a/app/routes/wow.out-of-stock.tsx b/app/routes/wow.out-of-stock.tsx
index 15417ebf..2ca6c120 100644
--- a/app/routes/wow.out-of-stock.tsx
+++ b/app/routes/wow.out-of-stock.tsx
@@ -56,12 +56,20 @@ const validateInput = z.object({
populationBlizz: z.string().transform((value) => parseInt(value)),
rankingWP: z.string().transform((value) => parseInt(value)),
expansionNumber: z.string().transform((value) => parseInt(value)),
- includeCategories: z.string().transform((value) =>
- value.trim() === '' ? [] : value.split(',').map((value) => parseInt(value))
- ),
- excludeCategories: z.string().transform((value) =>
- value.trim() === '' ? [] : value.split(',').map((value) => parseInt(value))
- )
+ includeCategories: z
+ .string()
+ .transform((value) =>
+ value.trim() === ''
+ ? []
+ : value.split(',').map((value) => parseInt(value))
+ ),
+ excludeCategories: z
+ .string()
+ .transform((value) =>
+ value.trim() === ''
+ ? []
+ : value.split(',').map((value) => parseInt(value))
+ )
})
export const loader: LoaderFunction = async ({ request }) => {
@@ -106,7 +114,10 @@ export const action: ActionFunction = async ({ request }) => {
if (!validatedFormData.success) {
return json({
- exception: parseZodErrorsToDisplayString(validatedFormData.error, inputMap)
+ exception: parseZodErrorsToDisplayString(
+ validatedFormData.error,
+ inputMap
+ )
})
}
@@ -131,14 +142,18 @@ export const action: ActionFunction = async ({ request }) => {
})
} catch (error) {
return json({
- exception: error instanceof Error ? error.message : 'An unexpected error occurred'
+ exception:
+ error instanceof Error ? error.message : 'An unexpected error occurred'
})
}
}
const OutOfStock = () => {
const loaderData = useLoaderData()
- const result = useActionData<{ data?: OutOfStockItem[], exception?: string }>()
+ const result = useActionData<{
+ data?: OutOfStockItem[]
+ exception?: string
+ }>()
const transition = useNavigation()
const isSubmitting = transition.state === 'submitting'
const [searchParams, setSearchParams] = useState(loaderData)
@@ -158,7 +173,10 @@ const OutOfStock = () => {
}
}
- const handleFormChange = (name: keyof typeof defaultFormValues, value: string) => {
+ const handleFormChange = (
+ name: keyof typeof defaultFormValues,
+ value: string
+ ) => {
handleSearchParamChange(name, value)
setSearchParams((prev) => ({ ...prev, [name]: value }))
}
@@ -183,8 +201,8 @@ const OutOfStock = () => {
/>
-