Fix loading of standalone view contexts
Why
When loading a subclass of Hanami::View::Context from a gem (as a gem dependency to your own Hanami application), Hanami will layer on a bunch of Hanami application/slice specific behavior via the Hanami::Extensions::View::Context module. This all happens -- before any gem which uses the Hanami View gem in a standalone capacity -- is loaded within the Hanami application. This also means there isn't a great way for your own gem to detect and prevent this behavior.
How
The reason this crops up is that the following code is applied before any standalone gem is loaded. Here's the file/code in question:
# hanami/extensions/view/context.rb
Hanami::View::Context.include(Hanami::Extensions::View::Context::ClassExtension)Notes
If a gem uses the Hanami View gem in a standalone capacity, I don't think Hanami should try to force application specific behavior upon the gem since it's surprising and unexpected behavior. I would also expect that you can render a standalone view within a Hanami Action too.
Source: hanami/hanami