You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have implemented a reusable dialog component using Shadcn in my todo app. However, I'm encountering an issue where the component is not working as needed. The add form and update form opens only after clicking twice. And when we click the pencil icon immediately after adding a todo it will pop add form instead of update form. I'm using zustand for state management.
Discussed in #2354
I'm sorry this was resolved or closed by @dbritto-dev before solving the actual problem
Originally posted by Akshaypmna18 February 22, 2024
https://stackoverflow.com/questions/77826561/shadcn-reusuable-dialog-component-called-twice-renders-update-form-only
I have implemented a reusable dialog component using Shadcn in my todo app. However, I'm encountering an issue where the component is not working as needed. The add form and update form opens only after clicking twice. And when we click the pencil icon immediately after adding a todo it will pop add form instead of update form. I'm using zustand for state management.
Dialog Component
If I set 'setIsOpen(!isOpen)' the dialog component only shows the latest todo
update todo
add todo
demo
dialog component code
add todo code
update todo code
zustand store code
video for better understanding
Use devices with a width below 640 pixels or adjust it in the browser.
video after @dbritto-dev 's contribution
The text was updated successfully, but these errors were encountered: