Skip to content

refactor: modernize react refresh runtime helpers#98

Merged
chenjiahan merged 4 commits intomainfrom
chenjiahan/refactor-react-refresh-runtime
Apr 8, 2026
Merged

refactor: modernize react refresh runtime helpers#98
chenjiahan merged 4 commits intomainfrom
chenjiahan/refactor-react-refresh-runtime

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

Summary

  • modernize the react refresh client/runtime helpers with const, arrow functions, template literals, and simpler control flow
  • preserve the previous runtime behavior for async export handling and __esModule-only refresh boundaries while cleaning up the implementation

Testing

  • pnpm test

Related Links

  • None

@chenjiahan chenjiahan marked this pull request as ready for review April 8, 2026 02:36
Copilot AI review requested due to automatic review settings April 8, 2026 02:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR modernizes the React Refresh client/runtime helper code while aiming to preserve existing runtime behavior (notably around async exports and refresh boundary detection).

Changes:

  • Refactors refresh helpers to use const/let, arrow functions, template literals, and simplified control flow.
  • Keeps existing refresh boundary/signature logic intact while reducing boilerplate in shouldInvalidateReactRefreshBoundary and HMR handlers.
  • Minor style/consistency updates in the React Refresh entry/runtime wiring.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
client/refreshUtils.js Refactors module export extraction, boundary signature/invalidation, debounce update helper, and HMR dispose/accept handlers.
client/reactRefreshEntry.js Modernizes safeThis/global detection and injected-flag string building.
client/reactRefresh.js Simplifies refresh execution path and test-mode resolution while preserving Promise vs non-Promise export handling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

chenjiahan and others added 3 commits April 8, 2026 10:40
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@chenjiahan chenjiahan merged commit f088f5c into main Apr 8, 2026
4 checks passed
@chenjiahan chenjiahan deleted the chenjiahan/refactor-react-refresh-runtime branch April 8, 2026 02:44
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