Skip to content

Replace modules in place in wf dev with React Fast Refresh and import.meta.hot (#763) - #796

Open
ambroise-leclerc wants to merge 11 commits into
766-light-headerfrom
763-hmr
Open

ambroise-leclerc wants to merge 11 commits into
766-light-headerfrom
763-hmr

Conversation

@ambroise-leclerc

Copy link
Copy Markdown
Collaborator

Refs #763. Completes the work started in #787. Stacked on #795.

What changes

  • wf dev builds an incremental module graph and sends an update to the running preview instead of reloading it: the page, the bridge and the UI stay.
  • React Fast Refresh (@babel/standalone 7.29.17, react-refresh 0.19.0, in the environment lock) and a minimal import.meta.hot (accept, dispose, data, invalidate), used by wf dev only. An update no module accepts reloads the page and the terminal says why.
  • The Life React component moves to Life.tsx so that it can be refreshed.
  • DeveloperBrowserIntegration-hot: component edit keeping state, stylesheet edit, compile error and recovery, reload fallback, import.meta.hot, and a build that carries none of it.
  • ADR-014 amendments (proposed), documentation, changelog.

Limits

  • A literal import() or a top-level await falls back to a full reload. A hot preview is an unminified development build.
  • accept covers the module itself only; modules that imported it keep its former exports.
  • wf check has no built-in type for import.meta.hot.
  • The environment grows by the Babel transform (about 3 MB, downloaded only for React hot previews).
  • Nothing reaches users until environment 1.3.2 is published and pinned (the pin is 1.3.1).

Checks

CEF-off suite 826/826. CEF web integration 128/129 locally: five host-loop specs of WebFrontBrowserIntegration fail on the machine used, with and without these changes.

Comment thread js/developer/environment/hot.mjs Resolved
Comment thread js/developer/environment/hot.mjs Resolved
Comment thread js/developer/environment/hot.mjs Resolved
Comment thread js/developer/environment/hot.mjs Resolved

This branch has not been deployed

No deployments
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