Skip to content

fix: avoid homepage flash on share routes - #7

Merged
lifeodyssey merged 1 commit into
mainfrom
codex/fix-share-route-flash
Jun 19, 2026
Merged

lifeodyssey merged 1 commit into
mainfrom
codex/fix-share-route-flash

Conversation

@lifeodyssey

@lifeodyssey lifeodyssey commented Jun 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • replace the homepage static fallback with a share-page loading shell on /s/:slug routes
  • keep the homepage agent-readable fallback intact
  • add Worker-level regression tests for both paths

Verification

  • npm run build
  • npm run test -- tests/worker-index.test.ts tests/client/smoke.test.tsx

Summary by CodeRabbit

  • New Features

    • Share routes (/s/<id>) now display a loading placeholder while shared content loads, providing users with a distinct fallback experience separate from the standard homepage.
  • Tests

    • Added comprehensive tests verifying that share route fallbacks display loading state correctly, homepage routes display standard content, and configuration is properly injected in all scenarios.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Jun 19, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f4669e95-5795-4231-a494-0f70e4775573

📥 Commits

Reviewing files that changed from the base of the PR and between 4b95943 and 969f11d.

📒 Files selected for processing (3)
  • index.html
  • src/worker/index.ts
  • tests/worker-index.test.ts

📝 Walkthrough

Walkthrough

index.html gains two HTML comment markers delimiting a fallback region inside div#root. The worker's injectConfig function is updated to accept the incoming request and, for /s/<id> share routes, replace that marked region with a loading snippet before injecting window.__APP_CONFIG__. Two integration tests cover both the share route and homepage behaviors.

Changes

Share-route fallback HTML rewriting

Layer / File(s) Summary
HTML fallback markers and worker rewrite logic
index.html, src/worker/index.ts
index.html adds <!-- share-html:fallback:start --> and <!-- share-html:fallback:end --> markers around the visible content in div#root. injectConfig now accepts request, detects /s/<id> routes via isShareRoute, and calls replaceAppFallback with a shareRouteFallback loading snippet before injecting the config script into </head>.
Worker integration tests
tests/worker-index.test.ts
Two Vitest tests using a fixed INDEX_HTML fixture and mocked ASSETS.fetch/context. Asserts that /s/example returns "Loading share..." with window.__APP_CONFIG__ and no homepage copy, and that / returns homepage copy with window.__APP_CONFIG__ and no loading placeholder.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • lifeodyssey/share-html#6: Directly modifies the same injectConfig function in src/worker/index.ts to inject window.__APP_CONFIG__, which this PR extends with share-route detection and HTML rewriting.

Poem

A rabbit hops to /s/some-share,
And finds a spinner waiting there! 🐇
The markers say "replace this bit,"
The worker reads and makes it fit.
"Loading share…" glows on the screen,
The neatest fallback you have seen! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately describes the primary change: fixing a visual flash issue on share routes by providing appropriate fallback content.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-share-route-flash

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.

@lifeodyssey
lifeodyssey merged commit 3335237 into main Jun 19, 2026
2 checks passed
@lifeodyssey
lifeodyssey deleted the codex/fix-share-route-flash branch June 19, 2026 19:04
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