Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
Address source selector review feedback
EtienneLescotf38c881e229c
diff --git a/src/components/launch/LaunchWindow.test.tsx b/src/components/launch/LaunchWindow.test.tsxindex 2bf9c2dbe..c12c04921 100644--- a/src/components/launch/LaunchWindow.test.tsx+++ b/src/components/launch/LaunchWindow.test.tsx@@ -268,6 +268,46 @@ describe("LaunchWindow record button", () => {expect(recorderState.value.toggleRecording).not.toHaveBeenCalled();});+ it("clears record-after-selection intent when opening the source picker fails", async () => {+ window.electronAPI.openSourceSelector = vi.fn(async () => {+ throw new Error("source selector failed");+ });++ renderLaunchWindow();+ await waitForSourceSelectionSubscription();++ fireEvent.click(await screen.findByTestId("launch-record-button"));++ await waitFor(() => {+ expect(window.electronAPI.openSourceSelector).toHaveBeenCalledTimes(1);+ });++ emitSelectedSourceChanged(displayOneSource);++ await waitFor(() => {+ expect(screen.getByTestId("launch-record-button")).toHaveAttribute("title", "Display 1");+ });+ expect(recorderState.value.toggleRecording).not.toHaveBeenCalled();+ });++ it("handles selected source polling failures", async () => {+ const error = new Error("selected source unavailable");+ const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => undefined);+ stubElectronAPI(+ vi.fn(async () => {+ throw error;+ }),+ );++ renderLaunchWindow();++ await waitFor(() => {+ expect(warnSpy).toHaveBeenCalledWith("Failed to refresh selected source:", error);+ });++ warnSpy.mockRestore();+ });+it("starts recording when a source is already selected", async () => {stubElectronAPI(vi.fn(async () => displayOneSource));diff --git a/src/components/launch/LaunchWindow.tsx b/src/components/launch/LaunchWindow.tsxindex 6dde4543d..511ab8e5c 100644--- a/src/components/launch/LaunchWindow.tsx+++ b/src/components/launch/LaunchWindow.tsx@@ -442,9 +442,15 @@ export function LaunchWindow() {useEffect(() => {const checkSelectedSource = async () => {- if (window.electronAPI) {+ if (!window.electronAPI) {+ return;+ }++ try {const source = await window.electronAPI.getSelectedSource();applySelectedSource(source);+ } catch (error) {+ console.warn("Failed to refresh selected source:", error);}};@@ -488,11 +494,15 @@ export function LaunchWindow() {const handleRecordButtonClick = () => {if (!hasSelectedSource && !recording) {recordAfterSourceSelectionRef.current = true;- void openSourceSelector().then((result) => {- if (!result.opened) {+ void openSourceSelector()+ .then((result) => {+ if (!result.opened) {+ recordAfterSourceSelectionRef.current = false;+ }+ })+ .catch(() => {recordAfterSourceSelectionRef.current = false;- }- });+ });return;}