Skip to content

Commit a0f2c95

Browse files
committed
refactor(webapp): type Feedback open/setOpen as an all-or-none pair
1 parent 3724fe3 commit a0f2c95

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

apps/webapp/app/components/Feedback.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ type FeedbackProps = {
3030
button?: ReactNode;
3131
defaultValue?: FeedbackType;
3232
onOpenChange?: (open: boolean) => void;
33-
// Controlled mode — pass both to host the dialog outside a popover so the popover closing can't
34-
// unmount the form mid-submit (that teardown was intermittently canceling the feedback POST).
35-
open?: boolean;
36-
setOpen?: (open: boolean) => void;
37-
};
33+
} & (
34+
// Controlled mode is all-or-none: pass both open + setOpen to host the dialog outside a popover
35+
// (so the popover closing can't unmount the form mid-submit and cancel the feedback POST), or
36+
// neither for the self-managed, button-triggered dialog. Passing only one is a broken half-state.
37+
| { open?: never; setOpen?: never }
38+
| { open: boolean; setOpen: (open: boolean) => void }
39+
);
3840

3941
export function Feedback({
4042
button,

0 commit comments

Comments
 (0)