fix special request input updating upon editing from the bottom sheet

This commit is contained in:
2025-11-04 19:52:43 +03:00
parent 84e9e86356
commit 59745325ec
4 changed files with 11 additions and 5 deletions

View File

@@ -43,10 +43,10 @@ export function BottomSheet({
showCloseButton={false} showCloseButton={false}
initialSnap={1} initialSnap={1}
height={370} height={370}
snapPoints={["30vh"]} snapPoints={[370]}
> >
<div className="space-y-4"> <div>
<div> <div style={{ marginTop: 20 }}>
<TextArea <TextArea
value={value} value={value}
onChange={(e) => setValue(e.target.value)} onChange={(e) => setValue(e.target.value)}

View File

@@ -53,7 +53,7 @@ export function Dialog({
width={500} width={500}
destroyOnHidden destroyOnHidden
> >
<div className="space-y-4"> <div>
<TextArea <TextArea
value={value} value={value}
onChange={(e) => setValue(e.target.value)} onChange={(e) => setValue(e.target.value)}

View File

@@ -36,7 +36,6 @@ export default function SpecialRequestCard() {
label={t("cart.specialRequest")} label={t("cart.specialRequest")}
name="specialRequest" name="specialRequest"
style={{ position: "relative", top: -5 }} style={{ position: "relative", top: -5 }}
initialValue={specialRequest || ""}
> >
<Input <Input
placeholder={t("cart.specialRequest")} placeholder={t("cart.specialRequest")}

View File

@@ -1,13 +1,20 @@
import { Form } from "antd"; import { Form } from "antd";
import { useEffect } from "react"; import { useEffect } from "react";
import { selectCart } from "features/order/orderSlice";
import useBreakPoint from "hooks/useBreakPoint.ts"; import useBreakPoint from "hooks/useBreakPoint.ts";
import CartDesktopLayout from "pages/cart/components/CartDesktopLayout.tsx"; import CartDesktopLayout from "pages/cart/components/CartDesktopLayout.tsx";
import CartMobileTabletLayout from "pages/cart/components/CartMobileTabletLayout.tsx"; import CartMobileTabletLayout from "pages/cart/components/CartMobileTabletLayout.tsx";
import { useAppSelector } from "redux/hooks";
export default function CartPage() { export default function CartPage() {
const { isDesktop } = useBreakPoint(); const { isDesktop } = useBreakPoint();
const [form] = Form.useForm(); const [form] = Form.useForm();
const { specialRequest } = useAppSelector(selectCart);
useEffect(() => {
form.setFieldsValue({ specialRequest });
}, [form, specialRequest]);
// Prevent keyboard from appearing automatically on mobile // Prevent keyboard from appearing automatically on mobile
useEffect(() => { useEffect(() => {