#31273·extensions

Clipboard.copy() dismisses the main window in 2.4.1, destroying a just-pushed view

Author: speckofthecosmosCreated Sep 18, 2026Updated Sep 18, 2026

Description

Clipboard.copy() dismisses the Raycast main window. A view command that copies a value and then pushes a Detail loses the pushed view before it can be read.

This started on 2.4.1. The same extension code ran for months on 1.104.x without it, and rebuilding against @raycast/api 2.4.1 didn't change anything.

Nothing crashes. commandExited logs code: 0, and the pushed component stays mounted for several seconds after the window is gone. Only the window closes.

Steps To Reproduce

One view command, three actions. B is A plus a clipboard write, C is B with concealed.

typescript
import { Action, ActionPanel, Clipboard, Detail, List, useNavigation } from "@raycast/api";

function Result({ label }: { label: string }) {
  return <Detail markdown={`# ${label}\n\nIf you can read this, the window survived.`} />;
}

export default function Repro() {
  const { push } = useNavigation();

  async function pushOnly() {
    await new Promise((r) => setTimeout(r, 300)); // stand in for a network call
    push(<Result label="A" />);
  }

  async function copyThenPush() {
    await new Promise((r) => setTimeout(r, 300));
    push(<Result label="B" />);
    await Clipboard.copy("repro-value");
  }

  async function copyConcealedThenPush() {
    await new Promise((r) => setTimeout(r, 300));
    push(<Result label="C" />);
    await Clipboard.copy("repro-value", { concealed: true });
  }

  return (
    <List>
      <List.Item title="A (control)" actions={<ActionPanel><Action title="Run a" onAction={pushOnly} /></ActionPanel>} />
      <List.Item title="B (copy)" actions={<ActionPanel><Action title="Run B" onAction={copyThenPush} /></ActionPanel>} />
    </List>
  );
}

Run A, then B, then C.

Current Behaviour

A pushes the Detail and it stays on screen. B and C push the same Detail and the window closes immediately, so the result is never readable. concealed makes no difference, so this isn't the Clipboard History write path.

From the repro, pushed at .659 and .457:

pushed Window did resign key copy resolved
A, no copy .325 never
B, copy .659 .669 .693
C, concealed .457 .471 .496

Same thing in the extension this came from, instrumented to timestamp each step and lined up against raycast-x-*.log. The window resigns key while the copy is still in flight:

run Clipboard.copy() called Window did resign key copy resolved
1 .391 .400 .416
2 .911 .919 .935
3 .023 .030 .053

Removing that one line and changing nothing else, the window stayed up 3.6s until I dismissed it by hand.

The frontmost application never changes during any of this, so nothing is stealing focus. Ordering doesn't matter either. I tried the copy before the push and after it, and the dismissal tracks the copy call both ways.

Expected Behaviour

Writing to the clipboard leaves the window alone. A pushed Detail stays up until the user dismisses it.

Environment

Raycast 2.4.1, @raycast/api 2.4.1, macOS 27.0.0 (26A5416b), Apple Silicon.