Skip to content

Commit 70d741a

Browse files
committed
moved rails components
1 parent 0ee79ea commit 70d741a

File tree

16 files changed

+39
-36
lines changed

16 files changed

+39
-36
lines changed

ruby/hyper-component/lib/hyper-component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
require 'opal-activesupport'
3232
require 'reactive-ruby/version'
33-
require 'reactive-ruby/rails' if defined?(Rails)
33+
require 'hyperstack/internal/component/rails'
3434
require 'reactive-ruby/isomorphic_helpers'
3535
require 'reactive-ruby/serializers'
3636

ruby/hyper-component/lib/hyperstack/component.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ def self.included(base)
3030
base.extend(Hyperstack::Internal::Component::ClassMethods)
3131
end
3232

33+
def self.force_update!
34+
components = Hyperstack::Internal::Component.mounted_components.to_a
35+
components.each do |comp|
36+
next unless Hyperstack::Internal::Component.mounted_components.include? comp
37+
comp.force_update!
38+
end
39+
end
40+
3341
def self.deprecation_warning(message)
3442
Hyperstack.deprecation_warning(name, message)
3543
end

ruby/hyper-component/lib/hyperstack/internal/component/class_methods.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,6 @@ def add_item_to_tree(current_tree, new_item)
179179
def to_n
180180
ReactWrapper.class_eval('@@component_classes')[self]
181181
end
182-
183-
def force_update!
184-
components = Component.mounted_components.to_a
185-
components.each do |comp|
186-
next unless Component.mounted_components.include? comp
187-
comp.force_update!
188-
end
189-
end
190182
end
191183
end
192184
end
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
if defined?(Rails)
2+
require 'action_view'
3+
require 'react-rails'
4+
require 'hyperstack/internal/component/rails'
5+
require 'hyperstack/internal/component/rails/server_rendering/hyper_asset_container'
6+
require 'hyperstack/internal/component/rails/server_rendering/contextual_renderer'
7+
require 'hyperstack/internal/component/rails/component_mount'
8+
require 'hyperstack/internal/component/rails/railtie'
9+
require 'hyperstack/internal/component/rails/controller_helper'
10+
require 'hyperstack/internal/component/rails/component_loader'
11+
end

ruby/hyper-component/lib/reactive-ruby/component_loader.rb renamed to ruby/hyper-component/lib/hyperstack/internal/component/rails/component_loader.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Hyperstack
2-
module Component
3-
module Internal
2+
module Internal
3+
module Component
44
module Rails
55
class ComponentLoader
66
attr_reader :v8_context

ruby/hyper-component/lib/reactive-ruby/rails/component_mount.rb renamed to ruby/hyper-component/lib/hyperstack/internal/component/rails/component_mount.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Hyperstack
2-
module Component
3-
module Internal
2+
module Internal
3+
module Component
44
module Rails
55
class ComponentMount < React::Rails::ComponentMount
66
attr_accessor :controller
@@ -26,7 +26,7 @@ def context_initializer_options(options, name)
2626
existing_context_initializer = options[:prerender][:context_initializer]
2727

2828
options[:prerender][:context_initializer] = lambda do |ctx|
29-
IsomorphicHelpers.load_context(ctx, controller, name)
29+
Hyperstack::Component::IsomorphicHelpers.load_context(ctx, controller, name)
3030
existing_context_initializer.call(ctx) if existing_context_initializer
3131
end
3232

@@ -43,7 +43,7 @@ def top_level_name
4343
end
4444

4545
def footers
46-
IsomorphicHelpers.prerender_footers(controller)
46+
Hyperstack::Component::IsomorphicHelpers.prerender_footers(controller)
4747
end
4848
end
4949
end

ruby/hyper-component/lib/reactive-ruby/rails/controller_helper.rb renamed to ruby/hyper-component/lib/hyperstack/internal/component/rails/controller_helper.rb

File renamed without changes.

ruby/hyper-component/lib/reactive-ruby/rails/railtie.rb renamed to ruby/hyper-component/lib/hyperstack/internal/component/rails/railtie.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Hyperstack
2-
module Component
3-
module Internal
2+
module Internal
3+
module Component
44
module Rails
55
class Railtie < ::Rails::Railtie
66
config.before_configuration do |app|

ruby/hyper-component/lib/reactive-ruby/server_rendering/contextual_renderer.rb renamed to ruby/hyper-component/lib/hyperstack/internal/component/rails/server_rendering/contextual_renderer.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Hyperstack
2-
module Component
3-
module Internal
2+
module Internal
3+
module Component
44
module Rails
55
module ServerRendering
66
def self.context_instance_name

ruby/hyper-component/lib/reactive-ruby/server_rendering/hyper_asset_container.rb renamed to ruby/hyper-component/lib/hyperstack/internal/component/rails/server_rendering/hyper_asset_container.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
require 'react/server_rendering/webpacker_manifest_container'
44

55
module Hyperstack
6-
module Component
7-
module Internal
6+
module Internal
7+
module Component
88
module Rails
99
module ServerRendering
1010
class HyperTestAssetContainer
@@ -48,5 +48,5 @@ def assets_precompiled?
4848
end
4949
end
5050
end
51-
end
51+
end
5252
end

0 commit comments

Comments
 (0)