Skip to content

fix(post): single-flight open guard, focus-gated autoplay, autoplay race - #16

Merged
ghostcoder42 merged 1 commit into
mainfrom
fix/watch-open-autoplay
Oct 14, 2026
Merged

ghostcoder42 merged 1 commit into
mainfrom
fix/watch-open-autoplay

Conversation

@ghostcoder42

Copy link
Copy Markdown
Owner
  • single-flight guard for opening the post screen: rapid repeat taps on a card no longer stack multiple post screens (each with its own native player layering audio). The guard covers exactly the in-flight window — push until the pushed screen's transition ends (blur cleanup is the fallback unlock) — with no timer; once focused, the same video opens again immediately.

  • autoplay is gated on screen focus: a screen stacked under another — or whose detail query resolves long after the user backed out — never starts playing when its source lands late. The resume-on-refocus behavior is kept.

  • the play intent rides player construction + a readyToPlay re-assert: useVideoPlayer recreates the whole native player when the source lands, and a play() fired right after that recreation can race the native prepare and be silently dropped — the video then sat paused forever. Manual pause still wins over the retry.

  • retry: 0 on the video detail query: one 12s timeout then the error state with a retry button, instead of ~48s of spinner on a dead network that reads as a freeze.

- single-flight guard for opening the post screen: rapid repeat taps on
  a card no longer stack multiple post screens (each with its own
  native player layering audio). The guard covers exactly the in-flight
  window — push until the pushed screen's transition ends (blur cleanup
  is the fallback unlock) — with no timer; once focused, the same video
  opens again immediately.

- autoplay is gated on screen focus: a screen stacked under another —
  or whose detail query resolves long after the user backed out — never
  starts playing when its source lands late. The resume-on-refocus
  behavior is kept.

- the play intent rides player construction + a readyToPlay re-assert:
  useVideoPlayer recreates the whole native player when the source
  lands, and a play() fired right after that recreation can race the
  native prepare and be silently dropped — the video then sat paused
  forever. Manual pause still wins over the retry.

- retry: 0 on the video detail query: one 12s timeout then the error
  state with a retry button, instead of ~48s of spinner on a dead
  network that reads as a freeze.
@github-actions

Copy link
Copy Markdown

💯 Test Coverage

Lines Statements Branches Functions
Coverage: 56%
56.48% (997/1765) 49.26% (539/1094) 46.81% (257/549)

😎 Tests Results

Tests Skipped Failures Errors Time
308 0 💤 0 ❌ 0 🔥 18.996s ⏱️
👀 Tests Details • (56%)
File% Stmts% Branch% Funcs% LinesUncovered Line #s
All files56.4849.2646.8156.96 
src/api64.757.1442.8568.75 
   video-queries.ts64.757.1442.8568.7551–55, 91, 103–111
src/app/post83.8974.3875.6786 
   [id].tsx83.8974.3875.6786117–118, 120, 139–141, 264, 318–319, 364, 374, 413–492
src/components71.0580.754.5471.42 
   video-tile.tsx8082.510078.9465–70
src/lib/navigation100100100100 
   open-guard.ts100100100100 

@ghostcoder42
ghostcoder42 merged commit e85221e into main Oct 14, 2026
1 check passed
@ghostcoder42
ghostcoder42 deleted the fix/watch-open-autoplay branch October 14, 2026 21:21
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.

1 participant