Skip to content

Add hot reloading and make it possible to stop Elm apps - #1

Open
lydell wants to merge 17 commits into
safefrom
hot-reload-stop
Open

lydell wants to merge 17 commits into
safefrom
hot-reload-stop

Conversation

@lydell

@lydell lydell commented Nov 12, 2025 •

Copy link
Copy Markdown
Owner

Companion PR for elm/core#1155. See that one for details.

This PR is in my fork, since this PR is based on the safe branch. By having the PR in my fork, I can choose the safe branch as the base, so that the diff only shows the changes on top of safe.

This PR also fixes the timing of the initial draw, fixing a bug where web components that emit events while being rendered causes Elm to crash.

It’s easier to read the diff ignoring whitespace changes since some parts were indented.

lydell added 3 commits August 3, 2025 20:41
This adds hot reloading support for all the programs in elm/browser:

- `Browser.sandbox`
- `Browser.element`
- `Browser.document`
- `Browser.application`
- `Debugger.element`
- `Debugger.document`

It needs support in `Platform` in elm/core to work.
lydell added 14 commits October 16, 2026 10:08
The `popstate` event listener would be left behind due to calling the
wrong `shutdown` function.
Not needed anymore since commit 8d636c387ffaa53815be565d601b4e1456e2a5ab
in elm/core.
`stepper` is already a no-op when we send the `NoOp` message, so nothing
would be re-drawn anyway. And we don’t need to redraw anything, because
we are removing the entire debugger.

(Usually when closing the debugger, we need to trigger a redraw so we
stop rendering the debugger window and go back to rendering the corner.
But now we are also removing the corner. The reason for the manual
redraw trigger is because mutation is used behind the scenes for this.)
They were read from an object that is never mutated during hot reloading
(even if it looked like it at first glance).
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.

1 participant