On this page3 sections

When we shipped hot reload in v2.4.0, the most common question was how it keeps half-filled forms intact. The short answer: we never unmount the form.

Two kinds of modules

Every tool has state modules (forms, table selection, drawers) and logic modules (actions, formatters, column definitions). forge dev tags each module when it builds the graph.

When you save a file, the dev server walks up the graph from that file. If it only reaches logic modules, it swaps them in place and re-renders. The form component keeps its state because it never left the page.

// Swapping this file keeps the form open and filled in.
export const formatAmount = (cents: number) =>
  new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(cents / 100);

When it restarts

  • You changed forge.config.ts. Auth and data sources may have changed, so we restart the server.
  • You changed a component that owns state. React can’t keep state across a different component, so that subtree remounts.

Numbers

On our own 140-tool workspace, the median reload went from 2.1 s with a full restart to 160 ms.