From b3cf93308b77f2b20f5bff0bfd689dfbc46ed8fd Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Fri, 29 May 2026 04:48:30 -0700 Subject: [PATCH] Move Linear estimate input sync to popover open --- .../src/components/LinearItemDrawer.tsx | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/renderer/src/components/LinearItemDrawer.tsx b/src/renderer/src/components/LinearItemDrawer.tsx index 91a30ec378e..aae7f4f2f6b 100644 --- a/src/renderer/src/components/LinearItemDrawer.tsx +++ b/src/renderer/src/components/LinearItemDrawer.tsx @@ -76,6 +76,10 @@ export function formatLinearEstimateLabel(estimate: number | null | undefined): return estimate === null || estimate === undefined ? 'Set estimate' : `Estimate ${estimate}` } +function formatLinearEstimateInput(estimate: number | null | undefined): string { + return estimate === null || estimate === undefined ? '' : String(estimate) +} + function LinearEditChipAdornment({ loading, pending @@ -139,7 +143,6 @@ export function LinearIssueEditSection({ }: EditSectionProps): React.JSX.Element { const [labelPopoverOpen, setLabelPopoverOpen] = useState(false) const [estimatePopoverOpen, setEstimatePopoverOpen] = useState(false) - const [estimateInput, setEstimateInput] = useState('') const patchLinearIssue = useAppStore((s) => s.patchLinearIssue) const settings = useAppStore((s) => s.settings) const { isPending, run } = useImmediateMutation() @@ -152,19 +155,22 @@ export function LinearIssueEditSection({ labelIds: localLabelIds, labels: localLabels } = editState + const [estimateInput, setEstimateInput] = useState(() => formatLinearEstimateInput(localEstimate)) const teamId = issue.team?.id || null const states = useTeamStates(teamId, settings, issue.workspaceId) const labels = useTeamLabels(teamId, settings, issue.workspaceId) const members = useTeamMembers(teamId, settings, issue.workspaceId) - useEffect(() => { - if (!estimatePopoverOpen) { - setEstimateInput( - localEstimate === null || localEstimate === undefined ? '' : String(localEstimate) - ) - } - }, [estimatePopoverOpen, localEstimate]) + const handleEstimatePopoverOpenChange = useCallback( + (open: boolean) => { + setEstimatePopoverOpen(open) + if (open) { + setEstimateInput(formatLinearEstimateInput(localEstimate)) + } + }, + [localEstimate] + ) const handleStateChange = useCallback( (stateId: string) => { @@ -525,7 +531,7 @@ export function LinearIssueEditSection({ - +