Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit b40b947

Browse files
committed
closes #256 closes #255
1 parent 1b08bbd commit b40b947

8 files changed

+13
-51
lines changed

Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
source 'https://rubygems.org'
2+
gem 'hyperloop-config', path: '../hyperloop-config'
23
gem "opal-jquery", git: "https://github.com/opal/opal-jquery.git", branch: "master"
34
gemspec

hyper-react.gemspec

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
2525
spec.add_dependency 'hyper-store', React::VERSION
2626
spec.add_dependency 'opal', '>= 0.11.0', '< 0.12.0'
2727
spec.add_dependency 'opal-activesupport', '~> 0.3.1'
28+
spec.add_dependency 'hyperloop-config', React::VERSION
2829

2930
spec.add_development_dependency 'chromedriver-helper'
3031
spec.add_development_dependency 'hyper-spec', React::VERSION

lib/react/config.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
if RUBY_ENGINE != 'opal'
2-
require "react/config/server"
3-
else
4-
require "react/config/client"
2+
module Hyperloop
3+
define_setting :prerendering, :off
4+
end
55
end

lib/react/config/client.rb.erb

-19
This file was deleted.

lib/react/config/server.rb

-23
This file was deleted.

lib/react/react-source.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
else
1212
require "react/config"
1313
require "react/rails/asset_variant"
14-
react_directory = React::Rails::AssetVariant.new(React::Config.config).react_directory
14+
variant = Hyperloop.env.production? ? 'production' : 'development'
15+
react_directory = React::Rails::AssetVariant.new({environment: variant}).react_directory
1516
Opal.append_path react_directory.untaint
1617
end

lib/react/rendering_context.rb

+5-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def remove_nodes_from_args(args)
8080
# 3 an element that is NOT yet pushed on the rendering buffer
8181
# 4 or the last element pushed on the buffer
8282
#
83-
# in case 1 we change the object to a string, and then it becomes case 2
83+
# in case 1 we render a span
8484
# in case 2 we automatically push the string onto the buffer
8585
# in case 3 we also push the Element onto the buffer IF the buffer is empty
8686
# case 4 requires no special processing
@@ -93,7 +93,10 @@ def remove_nodes_from_args(args)
9393
def run_child_block(is_outer_scope)
9494
result = yield
9595
if result.respond_to?(:acts_as_string?) && result.acts_as_string?
96-
@buffer << result.to_s
96+
# hyper-mesh DummyValues respond to acts_as_string, and must
97+
# be converted to spans INSIDE the parent, otherwise the waiting_on_resources
98+
# flag will get set in the wrong context
99+
React::RenderingContext.render(:span) { result.to_s }
97100
elsif result.is_a?(String) || (result.is_a?(React::Element) && @buffer.empty?)
98101
@buffer << result
99102
end

lib/reactive-ruby/isomorphic_helpers.rb

+1-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ def self.context
3737
def self.log(message, message_type = :info)
3838
message = [message] unless message.is_a? Array
3939

40-
is_production = React::Config.config[:environment] == 'production'
41-
42-
if (message_type == :info || message_type == :warning) && is_production
40+
if (message_type == :info || message_type == :warning) && Hyperloop.env.production?
4341
return
4442
end
4543

0 commit comments

Comments
 (0)