Skip to content

fix(mobile): stop spinning forever on failed asset previews - #7683

Closed
shubhxho wants to merge 3 commits into
pingdotgg:mainfrom
shubhxho:fix/mobile-asset-preview-errors
Closed

fix(mobile): stop spinning forever on failed asset previews#7683
shubhxho wants to merge 3 commits into
pingdotgg:mainfrom
shubhxho:fix/mobile-asset-preview-errors

Conversation

@shubhxho

@shubhxho shubhxho commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Asset preview URLs returning null meant loading, disconnected, and error. The preview screens treated every null as Preparing and spun until you left.

The hook now distinguishes those states. Previews show a short failure and a retry. Favicons still stay quiet when they don't have a URL.

Fixes #7630


Note

Cursor Bugbot is generating a summary for commit 31b552b. Configure here.

Note

Fix mobile asset preview spinning forever on failed asset URLs

  • Adds AssetUrlState discriminated union and resolveAssetUrlState in assetUrlState.ts to map connection + request state into Loading/Disconnected/Failure/Success
  • Adds useAssetUrlState hook in assets.ts exposing status and retry; reimplements useAssetUrl on top of it for backward compatibility
  • Updates WorkspaceFileImagePreview, WorkspaceFileWebPreview, and FileContent to render WorkspaceFileAssetPreviewPlaceholder with contextual empty state and retry on non-success states; ThreadFilesRouteScreen header Refresh now triggers assetPreview.retry() and appends a revision query param for cache-busting
  • Adds tests covering resolveAssetUrlState across unrequested/loading/disconnected/failure/success/waiting cases in assetUrlState.test.ts
  • Behavioral Change: preview components now receive status: AssetUrlState + onRetry instead of a nullable URL string; callers passing the old props will not compile

Macroscope summarized 6af0d59.

Null from the asset URL hook meant loading, disconnected, and error. Previews now show the failure and a retry instead of Preparing forever.

Fixes pingdotgg#7630
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bdef100d-f48f-41af-9065-234b4c4562fb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 20, 2026
Comment thread apps/mobile/src/state/assetUrlState.ts Outdated
@macroscopeapp

macroscopeapp Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 6af0d59

Macroscope's review found this PR approvable — This bug fix adds proper error handling for mobile asset preview loading failures. Changes are self-contained to mobile preview UI, maintain backward compatibility, and include comprehensive unit tests for the new state resolution logic.

You can add or adjust custom eligibility rules. Learn more.

Comment thread apps/mobile/src/state/assetUrlState.ts Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 020efc6. Configure here.

Comment thread apps/mobile/src/state/assetUrlState.ts Outdated
@randroid88

Copy link
Copy Markdown

Reporter of #7630 here — I reviewed this and ran it locally. Summary:

The fix is the right shape. The AssetUrlState machine (Loading/Disconnected/Failure/Success + retry) matches what the issue asked for, and both Cursor Bugbot findings are addressed in the final revision: Success is checked before waiting (background refresh no longer unmounts a live preview) and waiting before Failure (retry shows the spinner again). assetUrlState.test.ts and the mobile typecheck pass locally on this branch.

The failing CI check looks like an infra flake, not this PR — the job log shows it died ~30s in during toolchain install (vite+/rustup) with no test/lint/type failure anywhere; teardown follows immediately. A re-run should clear it.

The real blocker is bitrot against main. Two days after this was opened, #6433 landed a simpler useAssetUrlState in apps/mobile/src/state/assets.ts, and the file screen's menu has since been refactored into a fileMenuActions array — this branch now conflicts. I did the reconciliation locally to test it on today's main: keep this PR's richer hook as the single implementation, adapt ThreadFeed.tsx's ThreadMarkdownImage to destructure { status }, and move the retry() call into the menu-array's refresh action. That compiles clean with tests passing — happy to share the diff if useful.

Machine-verified on a Pixel 8 Pro dev client (rebased-onto-main build): the Success path delivers URLs into the preview components correctly. I was not able to cleanly capture the Disconnected UI on device due to test-rig issues on my side — not evidence against the PR, just honestly unverified.

Would love to see this rebased and landed; it fixes a real daily annoyance.

— verified with Claude Fable 5 via Claude Code

@t3dotgg

t3dotgg commented Sep 4, 2026

Copy link
Copy Markdown
Member

Note

🤖 GPT-6 Astra (preview) responding on behalf of Theo

This was closed as part of an automated cleanup pass. If you believe it was closed in error, reply here and we will get it reopened.

Closing as superseded by merged #9123. Main now distinguishes disconnected environments and failed asset URL requests, shows an error, and offers retry instead of an endless preview spinner. This covers the failure and retry flow proposed here.

@t3dotgg t3dotgg closed this Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Mobile asset previews spin forever when asset URL creation or environment connection fails

3 participants