Reload the console in place instead of re-execing it - #444
Open
afomera wants to merge 1 commit into
Open
Conversation
`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.
Contributor
|
ℹ️ Optional job failed: Ruby jruby |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
reloadre-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 viaHanami::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_reloadingoff, re-exec exactly as before.Slice readers now resolve through
app.sliceson 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.