Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/desktop/src/routes/editor/ExportDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ export function ExportDialog() {
const metadata = await commands.getVideoMetadata(projectPath);
const plan = await commands.checkUpgradedAndUpdate();
const canShare = {
allowed: plan || metadata.duration < 300,
reason: !plan && metadata.duration >= 300 ? "upgrade_required" : null,
allowed: plan || (exportEstimates.data?.duration_seconds ?? metadata.duration < 300),
reason: !plan && (exportEstimates.data?.duration_seconds ?? metadata.duration >= 300) ? "upgrade_required" : null,
Comment on lines +317 to +318
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: Operator precedence breaks duration check.

The ?? operator has lower precedence than comparison operators, so line 317 is parsed as:

plan || ((exportEstimates.data?.duration_seconds) ?? (metadata.duration < 300))

When exportEstimates.data?.duration_seconds is nullish, the fallback is the boolean metadata.duration < 300, not the numeric metadata.duration. This breaks the duration check entirely. Line 318 has the same issue.

Apply this diff to fix the precedence:

       const canShare = {
-        allowed: plan || (exportEstimates.data?.duration_seconds ?? metadata.duration < 300),
-        reason: !plan && (exportEstimates.data?.duration_seconds ?? metadata.duration >= 300) ? "upgrade_required" : null,
+        allowed: plan || (exportEstimates.data?.duration_seconds ?? metadata.duration) < 300,
+        reason: !plan && (exportEstimates.data?.duration_seconds ?? metadata.duration) >= 300 ? "upgrade_required" : null,
       };
🤖 Prompt for AI Agents
In apps/desktop/src/routes/editor/ExportDialog.tsx around lines 317 to 318, the
nullish coalescing is evaluated before the comparison due to operator
precedence, causing the fallback to be a boolean; wrap the coalescing expression
in parentheses so you first choose the numeric duration and then compare it to
300 (e.g. use (exportEstimates.data?.duration_seconds ?? metadata.duration) <
300 for the allowed check and the analogous >= 300 expression for the reason
check).

};

if (!canShare.allowed) {
Expand Down