Ah yes, you are running into this problem.
This is a reminder that I need to make the time to work on a resolution for this. In the meantime, you can follow the mitigation I used:
require "hanami/slice/router"
class RouteResolver < Hanami::Slice::Routing::Resolver
def excluding?(slice_name)
if slices && slice_dirs.include?(slice_name)
slice_name = slice_name.to_s
slices.none? { _1 == slice_name }
else
false
end
end
private
def slices = slice.config.slices
def slice_dirs
@_slice_dirs ||=
Dir[slice.root / "slices" / "*"]
.select { |path| File.directory?(path) }
.map { |path| File.basename(path).to_sym }
end
end
module SliceRouting
def slice(slice_name, ...)
return if @resolver.excluding?(slice_name)
super
end
end
Hanami::Slice::Router.prepend SliceRouting
class App < Hanami::App
config.router.resolver = RouteResolver
end