@@ -24,6 +24,9 @@ class Base < ActionView::Base
24
24
class_attribute :slots
25
25
self . slots = { }
26
26
27
+ class_attribute :vc_lookup_context
28
+ self . vc_lookup_context = ActionView ::LookupContext . new ( ActionView ::PathSet . new ( [ Rails . root . join ( "app/components" ) ] ) , { } , [ ] )
29
+
27
30
# Entrypoint for rendering components.
28
31
#
29
32
# view_context: ActionView context from calling view
@@ -52,9 +55,7 @@ def render_in(view_context, &block)
52
55
self . class . compile ( raise_errors : true )
53
56
54
57
@view_context = view_context
55
- @lookup_context ||= view_context . lookup_context . tap do |c |
56
- c . view_paths . unshift ( Rails . root . join ( "app/components" ) )
57
- end
58
+ @lookup_context = vc_lookup_context
58
59
59
60
# required for path helpers in older Rails versions
60
61
@view_renderer ||= view_context . view_renderer
@@ -66,7 +67,7 @@ def render_in(view_context, &block)
66
67
@virtual_path ||= virtual_path
67
68
68
69
# For template variants (+phone, +desktop, etc.)
69
- @variant ||= @ lookup_context. variants . first
70
+ @variant ||= view_context . lookup_context . variants . first
70
71
71
72
# For caching, such as #cache_if
72
73
@current_template = nil unless defined? ( @current_template )
0 commit comments