diff --git a/src/components/IssueStateButton.svelte b/src/components/IssueStateButton.svelte index f97f95ae2..2eb159ab6 100644 --- a/src/components/IssueStateButton.svelte +++ b/src/components/IssueStateButton.svelte @@ -14,10 +14,10 @@ const { save, - ...rest + issueState, }: { - state: State; save: (state: State) => Promise; + issueState: State; } = $props(); const actions: { caption: string; state: State }[] = [ @@ -29,10 +29,14 @@ { caption: "Close as other", state: { status: "closed", reason: "other" } }, ]; - // Pick a default for the action button when the issue state changes. let selectedAction = $state( - rest.state.status === "open" ? actions[1] : actions[0], + issueState.status === "open" ? actions[1] : actions[0], ); + + // React to state changes that come from outside of this button. + $effect(() => { + selectedAction = issueState.status === "open" ? actions[1] : actions[0]; + });