Skip to content
This repository was archived by the owner on Oct 16, 2026. It is now read-only.

feat(dev): live reload with an error overlay (--no-live-reload to opt out) - #58

Merged
kody-bot merged 1 commit into
mainfrom
cursor/kody-dev-live-reload-354f
Oct 15, 2026
Merged

kody-bot merged 1 commit into
mainfrom
cursor/kody-dev-live-reload-354f

Conversation

@kentcdodds

@kentcdodds kentcdodds commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Stack: #63 → #58 → #61 → #59 → #60

Intent

Second of five stacked kody dev PRs (base: the correctness + logs PR). Browser pages reload after each rebuild and show build and runtime errors in place. There is no HMR.

Door: two-way

Cleanup: none

Summary

  • HTML responses get a small <script src="/__kody/dev/client.js">. It listens on the SSE stream /__kody/dev/events (hello, reload, build_error, runtime_error) and reloads the page after a swap to a new build.
  • Build errors, and runtime errors from the page's own fetch calls, show a shadow-DOM overlay. The page reloads on the next good build. The dev error pages include the client too, so they recover on their own.
  • The script is injected only into uncompressed text/html responses to requests that accept text/html. JSON, compressed bodies, and agent fetches are left untouched.
  • On by default. --no-live-reload turns it off, and then the dev routes are not served either.
  • test/dev-server-harness.ts is factored out of dev-server.test.ts for reuse.

Testing

  • npm run validate passes.
  • New test/dev-live-reload.test.ts covers: injection placement; the cases that must not be injected; SSE reload and build_error events end to end; and liveReload: false.
  • Manual browser check: a syntax error shows the overlay with app/message.ts:1:24 and a code frame. Fixing it reloads the page automatically.

Build error overlay with file:line:col and a code frame
Page reloaded automatically after the fix

Open in Web Open in Cursor 

Note

Low Risk
Dev-server-only behavior behind localhost; opt-out flag exists and injection is limited to uncompressed HTML.

Reviewed by Cursor Bugbot for commit 98621b7. Bugbot is set up for automated code reviews on this repo. Configure here.

@kentcdodds

Copy link
Copy Markdown
Owner Author

bugbot run

3 similar comments
@kentcdodds

Copy link
Copy Markdown
Owner Author

bugbot run

@kentcdodds

Copy link
Copy Markdown
Owner Author

bugbot run

@kentcdodds

Copy link
Copy Markdown
Owner Author

bugbot run

Base automatically changed from cursor/kody-dev-correctness-logs-354f to main October 15, 2026 06:23
… out)

HTML responses from kody dev get a small module script that listens on
/__kody/dev/events (SSE). The page reloads after each swap to a new build;
build errors and runtime errors from the page's fetches show an overlay, and
the error pages reload themselves once the next build is good. Compressed
HTML and kody dev fetch responses are untouched. No HMR yet.
@cursor
cursor Bot force-pushed the cursor/kody-dev-live-reload-354f branch from 69a26a8 to 98621b7 Compare October 15, 2026 06:25
@kentcdodds

Copy link
Copy Markdown
Owner Author

bugbot run

2 similar comments
@kentcdodds

Copy link
Copy Markdown
Owner Author

bugbot run

@kentcdodds

Copy link
Copy Markdown
Owner Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 98621b7. Configure here.

@cursor
cursor Bot force-pushed the cursor/kody-dev-live-reload-354f branch from 8362887 to 98621b7 Compare October 15, 2026 06:50
@kody-bot
kody-bot merged commit dd29de8 into main Oct 15, 2026
13 checks passed
@kody-bot
kody-bot deleted the cursor/kody-dev-live-reload-354f branch October 15, 2026 06:51
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.24.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants