Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(export): ask on the first export, and only within its own session

EtienneLescota65082005287
diff --git a/electron/star-prompt.test.ts b/electron/star-prompt.test.ts
index 46dd07b51..7afa3c728 100644
--- a/electron/star-prompt.test.ts
+++ b/electron/star-prompt.test.ts
@@ -16,10 +16,10 @@ const state = (patch: Partial<StarPromptState> = {}): StarPromptState => ({
});
describe("star prompt policy", () => {
- it("offers on the second successful export and on no other", () => {
- expect(offersStarPrompt(state({ successfulExports: 1 }))).toBe(false);
- expect(offersStarPrompt(state({ successfulExports: 2 }))).toBe(true);
- expect(offersStarPrompt(state({ successfulExports: 3 }))).toBe(false);
+ it("offers on the first successful export and on no other", () => {
+ expect(offersStarPrompt(state({ successfulExports: 0 }))).toBe(false);
+ expect(offersStarPrompt(state({ successfulExports: 1 }))).toBe(true);
+ expect(offersStarPrompt(state({ successfulExports: 2 }))).toBe(false);
expect(offersStarPrompt(state({ successfulExports: 50 }))).toBe(false);
});
@@ -38,7 +38,7 @@ describe("star prompt policy", () => {
it("keeps every veto independent of the export count", () => {
// A veto that only held at the offer count would let the prompt through the moment the
// count moved past it, which is exactly when a regression would go unnoticed.
- for (const count of [1, 2, 3]) {
+ for (const count of [0, 1, 2]) {
expect(offersStarPrompt(state({ successfulExports: count, dismissed: true }))).toBe(false);
expect(offersStarPrompt(state({ successfulExports: count, recording: true }))).toBe(false);
expect(offersStarPrompt(state({ successfulExports: count, headless: true }))).toBe(false);
diff --git a/electron/star-prompt.ts b/electron/star-prompt.ts
index f3338cf4e..25e411878 100644
--- a/electron/star-prompt.ts
+++ b/electron/star-prompt.ts
@@ -5,9 +5,10 @@
// Everything in this file exists to make that ask happen AT MOST ONCE. Nothing here gates a
// feature, and nothing here is reported anywhere: the counters below never leave the machine.
-/** The export that earns the ask. The first export is someone trying the app out; by the second
- * they have chosen to use it, and the question is worth one line of their attention. */
-export const STAR_PROMPT_AT_EXPORT = 2;
+/** The export that earns the ask: the first one. A finished export is the moment the app has
+ * just delivered what the user came for, and waiting for a second would simply never ask the
+ * people who only ever export once — which is most of them. */
+export const STAR_PROMPT_AT_EXPORT = 1;
export interface StarPromptState {
/** Successful exports on this installation, including the one that just finished. */
diff --git a/src/components/ai-edition/ExportDialog.tsx b/src/components/ai-edition/ExportDialog.tsx
index 73c747de6..7ccaf625b 100644
--- a/src/components/ai-edition/ExportDialog.tsx
+++ b/src/components/ai-edition/ExportDialog.tsx
@@ -284,6 +284,10 @@ export function ExportDialog({ open, onClose, document }: ExportDialogProps) {
setError(null);
setSavedPath(null);
setCancelPending(false);
+ // This component stays mounted across `open`, so an unanswered prompt would otherwise
+ // survive the close and reappear on a later export's done panel — a second ask, which
+ // is the one thing the whole feature is built to avoid.
+ setStarPrompt(null);
}
}, [open]);
@@ -336,6 +340,7 @@ export function ExportDialog({ open, onClose, document }: ExportDialogProps) {
setProgress(null);
setSavedPath(null);
setCancelPending(false);
+ setStarPrompt(null);
let pickedPath: string | undefined;
try {
@@ -439,6 +444,10 @@ export function ExportDialog({ open, onClose, document }: ExportDialogProps) {
void window.electronAPI
?.starPromptExportFinished?.()
.then((result) => {
+ // The same generation guard the save picker uses: a close or a newer export
+ // invalidates this answer, and an IPC round trip is long enough for either to
+ // have happened. Without it a late "yes" lands on a dialog that has moved on.
+ if (generation !== pickerGeneration.current) return;
if (result?.offer) setStarPrompt({ store: result.store });
})
.catch((err) => console.warn("[export] star prompt check failed:", err));
diff --git a/src/i18n/locales/ja-JP/editor.json b/src/i18n/locales/ja-JP/editor.json
index 16277f51d..6f5062c3f 100644
--- a/src/i18n/locales/ja-JP/editor.json
+++ b/src/i18n/locales/ja-JP/editor.json
@@ -193,7 +193,7 @@
"exportedVideo": "動画をエクスポートしました",
"showInFolder": "フォルダーで表示",
"starPrompt": "OpenScreen は無料で、MIT ライセンスです。GitHub でスターを付けると、他の人が見つけやすくなります。",
- "starPromptNoThanks": "今はしない",
+ "starPromptNoThanks": "結構です",
"rateOnStore": "Microsoft Store で評価する",
"exportFailed": "エクスポートに失敗しました",
"failedToWriteFile": "ファイルの書き込みに失敗しました",