Skip to content

[Bug] Solid HMR loses context providers after bulk edits to high-fanout modules #189

@Astro-Han

Description

@Astro-Han

Symptoms

When the dev server is running, a large bulk edit to a high-fanout module, for example packages/ui/src/components/icon.tsx, can leave some components detached from their context providers during HMR. The browser then reports errors such as:

Error: Layout context must be used within a context provider
    at use (packages/ui/src/context/helper.tsx:37)
    at DialogSelectFile2 (packages/app/src/components/dialog-select-file.tsx:197)
    at HMRComp.createMemo.name (@solid-refresh:25)

The same branch previously reproduced a similar useGlobalSync must be used within GlobalSyncProvider error. The failing provider changed, but the symptom pattern was the same.

Reproduction

  1. Run bun dev:desktop.
  2. Make a large bulk edit to packages/ui/src/components/icon.tsx, for example replacing 70+ SVG entries in one change.
  3. Open a page that triggers a dialog, overlay, or similar re-render.

Current Workaround

Stop the dev server with Ctrl+C, then restart it with bun dev:desktop. A cold restart immediately recovers the app.

This appears to affect only the development loop. Production builds and typecheck still pass.

Suspected Cause

@solid-refresh may recreate referenced components after a large module-level constant change, while the parent provider instance is not re-wired correctly. App-root providers under packages/app/src/context/* should not be affected by a leaf icon module edit, but they appear to become detached through HMR.

Expected Behavior

The dev server should not lose app-root context providers after a leaf or high-fanout UI module changes.

If this is a Solid HMR limitation, a development-only full reload or dev overlay warning would be acceptable.

Priority

P3. This does not affect production, but it can disrupt the development loop during large UI refactors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low prioritybugSomething isn't workinguiDesign system and user interface

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions