diff --git a/src/dialogs/ConfirmationDialog.tsx b/src/dialogs/ConfirmationDialog.tsx index 816009b..fcd91eb 100644 --- a/src/dialogs/ConfirmationDialog.tsx +++ b/src/dialogs/ConfirmationDialog.tsx @@ -1,3 +1,6 @@ +// This implementation is derived from the solution provided by [baydisng13] in the discussion thread: +// https://github.com/shadcn-ui/ui/discussions/3875 + "use client"; import React from "react"; diff --git a/src/store/confirmationStore.ts b/src/store/confirmationStore.ts index 2a75b47..13e7b85 100644 --- a/src/store/confirmationStore.ts +++ b/src/store/confirmationStore.ts @@ -1,3 +1,6 @@ +// This implementation is derived from the solution provided by [baydisng13] in the discussion thread: +// https://github.com/shadcn-ui/ui/discussions/3875 + import { create } from "zustand"; interface ConfirmationState { @@ -42,10 +45,14 @@ const useConfirmationStore = create( onAction: data.onAction, })), closeConfirmation: () => { + // Close the confirmation dialog by setting the 'open' state to false. set((state) => ({ ...state, open: false, })); + // After a short delay (100ms), reset the dialog's state to its initial values. + // This delay ensures that the dialog is fully closed before resetting, + // preventing any visual flickering or UI inconsistencies. setTimeout(() => { set((state) => ({ ...state,