isomorfeus-preact 23.9.0.rc9 → 23.9.0.rc10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc7967e40af3865c729c12628d252d950d9fcb6ac1dc66c7043805d422c15cda
4
- data.tar.gz: a01a076af444ff136da418a997aae6f45fe9419c6ef6a6573b027335958977e1
3
+ metadata.gz: e11d06cc37c522f3950c5dc8c03c72ad856c597180bec57e2d0bfea892a6aef5
4
+ data.tar.gz: 4f8ec478471f0b619cd842f08f52f2c4e1575fc4171058bfbfc73134b9802e46
5
5
  SHA512:
6
- metadata.gz: 935475cdc19f4e3d329fbf1feb8714d216011a19785887771695cdb1144c3e8ba1985cef1f86d9ea5c787fa11fd31857a7697dec5a5b089c84836a827b750c2f
7
- data.tar.gz: 6aa27c2d7d2f38d0b7c7fb8b1a474b4f6047ac883b68f45cba8e2fcc4286c24ebceaa7bb6d4719574904e81704111466e5109d96e53cd18720f6ba6e3e206dce
6
+ metadata.gz: aff68e7e72f35d2277afb7d2220cf9c48fd6b3ee28e9645849f067f1342483540ee153aacdf733aa1014e62e5bc9c0790886447300d376382f8051419609aa3a
7
+ data.tar.gz: fcdc23ceac7f3eed1ee51a49127507f6c7eab2f1bbbd46297422aa711783f36091fcbb9b359fa85b634a7d113d0a26d96bcaa20fce905b8b4e3a09bea831181e
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  module Preact
3
- VERSION = '23.9.0.rc9'
3
+ VERSION = '23.9.0.rc10'
4
4
  end
5
5
  end
@@ -18,26 +18,18 @@ module Preact
18
18
  end
19
19
 
20
20
  def mount_component(component_name, props = {}, skip_ssr: false, keep_state: false)
21
- ssr_start_time = Time.now if Isomorfeus.development?
22
21
  locale = props.delete(:locale)
23
22
  location_host = props[:location_host] ? props[:location_host] : 'localhost'
24
23
  location = "#{props[:location_scheme] || 'http:'}//#{location_host}#{props[:location]}"
25
24
 
26
- rendered_tree, application_state, @_ssr_styles = Isomorfeus::TopLevel.mount_component(component_name, props, location, locale, skip_ssr, keep_state)
25
+ rendered_tree, @_ssr_application_state, @_ssr_styles = Isomorfeus::TopLevel.mount_component(component_name, props, location, locale, skip_ssr, keep_state)
27
26
  component_name = component_name.to_s unless component_name.is_a?(String)
28
27
  usids = if Isomorfeus.respond_to?(:current_user) && Isomorfeus.current_user && !Isomorfeus.current_user.anonymous?
29
28
  Isomorfeus.current_user.sid.to_s
30
29
  else
31
30
  nil
32
31
  end
33
-
34
- @_ssr_data = <<~HTML
35
- <script type='application/javascript'>
36
- ServerSideRenderingStateJSON = #{Oj.dump(application_state, mode: :strict)}
37
- ServerSideRenderingProps = #{Oj.dump({ env: Isomorfeus.env, component_name: component_name, props: props, hydrated: !skip_ssr, usids: usids }, mode: :strict)}
38
- </script>
39
- HTML
40
- puts "Preact::ViewHelper Server Side Rendering took ~#{((Time.now - ssr_start_time)*1000).to_i}ms" if Isomorfeus.development?
32
+ @_ssr_props = { env: Isomorfeus.env, component_name: component_name, props: props, hydrated: !skip_ssr, usids: usids }
41
33
  rendered_tree ? rendered_tree : "SSR didn't work"
42
34
  end
43
35
 
@@ -46,7 +38,7 @@ module Preact
46
38
  end
47
39
 
48
40
  def ssr_data
49
- @_ssr_data
41
+ @_ssr_data ||= render_ssr_data
50
42
  end
51
43
 
52
44
  def ssr_styles
@@ -55,6 +47,15 @@ module Preact
55
47
 
56
48
  private
57
49
 
50
+ def render_ssr_data
51
+ <<~HTML
52
+ <script type='application/javascript'>
53
+ ServerSideRenderingStateJSON = #{Oj.dump(@_ssr_application_state, mode: :strict)}
54
+ ServerSideRenderingProps = #{Oj.dump(@_ssr_props, mode: :strict)}
55
+ </script>
56
+ HTML
57
+ end
58
+
58
59
  def component_cache
59
60
  @_component_cache ||= Isomorfeus.component_cache_init_block.call
60
61
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isomorfeus-preact
3
3
  version: !ruby/object:Gem::Version
4
- version: 23.9.0.rc9
4
+ version: 23.9.0.rc10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
@@ -78,28 +78,28 @@ dependencies:
78
78
  requirements:
79
79
  - - '='
80
80
  - !ruby/object:Gem::Version
81
- version: 23.9.0.rc9
81
+ version: 23.9.0.rc10
82
82
  type: :runtime
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - '='
87
87
  - !ruby/object:Gem::Version
88
- version: 23.9.0.rc9
88
+ version: 23.9.0.rc10
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: isomorfeus-redux
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - '='
94
94
  - !ruby/object:Gem::Version
95
- version: 23.9.0.rc9
95
+ version: 23.9.0.rc10
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - '='
101
101
  - !ruby/object:Gem::Version
102
- version: 23.9.0.rc9
102
+ version: 23.9.0.rc10
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: benchmark-ips
105
105
  requirement: !ruby/object:Gem::Requirement