Skip to content

Reload the console in place instead of re-execing it - #444

Open
afomera wants to merge 1 commit into
mainfrom
console-in-process-reload
Open

Reload the console in place instead of re-execing it#444
afomera wants to merge 1 commit into
mainfrom
console-in-process-reload

Conversation

@afomera

@afomera afomera commented Aug 20, 2026

Copy link
Copy Markdown
Member

reload re-execed the console to pick up a code change, throwing away the session: local variables, history, everything built up so far. Hanami can now reload in place via Hanami::Slice#reload!, so the session survives. reload! is accepted too, since it is what Rails users reach for.

Apps that cannot reload in place, either an older Hanami or one with config.code_reloading off, re-exec exactly as before.

Slice readers now resolve through app.slices on each call. A reload replaces slice classes, so a reader that closed over the slice it saw at console start would hand out one whose container had been discarded.

This is safe to go in once the Hanami slice reloading goes in, though technically it could go in now if we wanted it to and we were happy with the dev api the reloader and slice reloading will take.

See: hanami/hanami#1625
hanami/hanami-reloader#37 for related code.

`reload` re-execed the console to pick up a code change, throwing away
the session: local variables, history, everything built up so far.
Hanami can now reload in place via `Hanami::Slice#reload!`, so the
session survives. `reload!` is accepted too, since it is what Rails
users reach for.

Apps that cannot reload in place, either an older Hanami or one with
`config.code_reloading` off, re-exec exactly as before.

Slice readers now resolve through `app.slices` on each call. A reload
replaces slice classes, so a reader that closed over the slice it saw
at console start would hand out one whose container had been discarded.
@github-actions

Copy link
Copy Markdown
Contributor

ℹ️ Optional job failed: Ruby jruby

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