Skip to content

Hot restart should restore the page to its initial state by default, or require a custom hook #1762

Closed
@jakemac53

Description

@jakemac53

Today the default handler simply invokes main(), but that won't get rid of the existing application on the page. Thus, if you append some tags to the body in your main(), then it will keep appending new copies of the app.

Internally we deep clone the original document.body before initially calling main, and then restore it to that state before we re-invoke main. This definitely isn't a universal solution, but is somewhat reasonable and tends to work for a lot of apps.

We could either implement that as the default, or we could possibly just require some top level hook to be implemented before we will even attempt to hot restart.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions