Skip to content

Commit 78aed61

Browse files
fix: prevent duplicate PR thread creation, clean up DB duplicates
1 parent 8487a94 commit 78aed61

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

crates/tauri-app/frontend/src/components/github/PrDashboard.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ export function PrDashboard(props: Props) {
5050
}
5151
}
5252

53+
const [creatingPr, setCreatingPr] = createSignal<number | null>(null);
54+
5355
async function createPrThread(pr: PullRequest) {
56+
if (creatingPr() === pr.number) return; // Prevent double-click
57+
setCreatingPr(pr.number);
5458
try {
5559
// Step 1: Create thread and store PR link in parallel
5660
const [thread] = await Promise.all([
@@ -96,6 +100,8 @@ export function PrDashboard(props: Props) {
96100
});
97101
} catch (e) {
98102
console.error("Failed to create PR thread:", e);
103+
} finally {
104+
setCreatingPr(null);
99105
}
100106
}
101107

@@ -193,7 +199,7 @@ export function PrDashboard(props: Props) {
193199
</div>
194200
</Show>
195201
</div>
196-
<button class="prd-thread-btn" onClick={() => createPrThread(pr)} title="Create thread for this PR">
202+
<button class="prd-thread-btn" onClick={() => createPrThread(pr)} disabled={creatingPr() === pr.number} title="Create thread for this PR">
197203
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
198204
<line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" />
199205
</svg>

0 commit comments

Comments
 (0)