Shopify / ui-extensions

MIT License
260 stars 36 forks source link

`<DateField />` Component just suddenly broken #2271

Closed muchisx closed 3 weeks ago

muchisx commented 3 weeks ago

Please list the package(s) involved in the issue, and include the version you are using

    "react": "^18.0.0",
    "@shopify/ui-extensions": "2024.4.x",
    "@shopify/ui-extensions-react": "2024.4.x"

Describe the bug

The DateField State handling is bugged, it resets its selection.

Anyone else recently having problems with the DateField checkout UI component?

We didn't make any changes to the code and it suddenly behaves weirdly, as a remoteUI component, I guess updates can be delivered to it without us knowing or doing anything, is it possible an update from shopify just broke it?

Seems odd too because components appear to also be linked to the Checkout UI extensions versioning? so I would expect they don't change unless we change our version

Steps to reproduce the behavior:

  1. Define a Test Extension component.
    
    export default reactExtension('purchase.checkout.cart-line-list.render-after', () => <Test />);

function Test() { const [selectedDate, setselectedDate] = useState(); console.log(selectedDate);

return <DateField label="Select a date" onChange={(value) => setselectedDate(value)} value={selectedDate} />; }


2. Open the preview
3. Try changing selection

## Expected behavior
Selection to be working as usual. 

## Screenshots

https://github.com/user-attachments/assets/0c3fc5c2-fbeb-4df3-839c-7e930a258a0b

![image](https://github.com/user-attachments/assets/36294bb7-a5f2-4c65-ace9-e0d49c720236)
stefanoHTB commented 3 weeks ago

I'm experiencing the same issue with the DateField component in Shopify's Checkout UI extensions. The selected date resets unexpectedly.

My environment:

"react": "^18.0.0"
"@shopify/ui-extensions": "2024.4.x"
"@shopify/ui-extensions-react": "2024.4.x"

We haven't made any recent changes to our code, so it's possible that a Shopify update might have caused this. Like you mentioned, since these components are part of the remote UI, they could receive updates without us being aware. Could this be related to the extension's versioning or an unintentional change on Shopify's end?

jun-shop commented 3 weeks ago

Thanks for reporting we're looking into it

jun-shop commented 3 weeks ago

I believe a fix should be shipped. Let us know if it's working again

muchisx commented 3 weeks ago

@jun-shop working on my side! Thank you!