Skip to content

Conversation

@ameer2468
Copy link
Contributor

@ameer2468 ameer2468 commented Sep 8, 2025

This PR makes sure the UI actually updates with the AI transcription generated.

Summary by CodeRabbit

  • New Features
    • Share page now auto-refreshes to display newly generated AI metadata without manual reloads.
  • Bug Fixes
    • More accurate loading state: when AI generation is enabled, the page shows loading until AI data is available or processing completes.
  • Performance
    • Reduced unnecessary data refetching by disabling automatic refetch on window focus and on mount, minimizing flicker and network usage.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 8, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds a server-side cache revalidation call after successful AI metadata generation and adjusts client-side Share page loading logic by broadening AI-loading conditions and removing automatic refetch-on-focus/mount behavior. No public APIs or signatures changed; error paths and overall control flow remain otherwise unchanged.

Changes

Cohort / File(s) Summary of Changes
Server status action revalidation
apps/web/actions/videos/get-status.ts
Import revalidatePath from next/cache and invoke revalidatePath(\/s/${videoId}`)` after successful AI metadata generation to refresh the share page. No changes to errors or exported signatures.
Share page loading/refetch behavior
apps/web/app/s/[videoId]/Share.tsx
Removed React Query options refetchOnWindowFocus and refetchOnMount. Expanded COMPLETE-state loading: if aiGenerationEnabled, show loading when aiData.processing is true OR when title, summary, and chapters are all absent.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant SP as Share Page (Client)
  participant VQ as useVideoStatus (React Query)
  participant GS as get-status (Server Action)
  participant AI as AI Metadata Generator
  participant NX as Next.js Cache

  U->>SP: Open /s/:videoId
  SP->>VQ: Start polling (interval-based)
  VQ->>GS: get-status(videoId)
  GS->>AI: Check AI generation state
  alt AI metadata just completed successfully
    AI-->>GS: Success + new metadata
    GS->>NX: revalidatePath(/s/:videoId)
    NX-->>GS: Path revalidated
  else In-progress or unchanged
    AI-->>GS: Processing / No update
  end
  GS-->>VQ: Status + aiData
  VQ-->>SP: Update UI
  note over SP: Loading shown if aiGenerationEnabled and (aiData.processing OR no AI fields)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • fix: ai transcription loading state #991 — Touches the same files and adjusts AI-loading/status logic; pairs with this PR’s revalidatePath addition by refining DB reads and loading/polling behavior.

Poem

A whisk of code, a hop of cache,
The share page freshens in a flash.
Polls still tick, but calmer now,
While AI thinks, we take a bow.
Revalidate! the burrow cries—
New titles bloom before our eyes. 🐇✨

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  - Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.
  - Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c9f08a6 and b13d393.

📒 Files selected for processing (2)
  • apps/web/actions/videos/get-status.ts (2 hunks)
  • apps/web/app/s/[videoId]/Share.tsx (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch revalidate-on-generation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ameer2468 ameer2468 merged commit 09110a0 into main Sep 8, 2025
13 of 15 checks passed
@ameer2468 ameer2468 deleted the revalidate-on-generation branch September 8, 2025 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants