isomorfeus-preact 23.9.0.rc9 → 23.9.0.rc11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isomorfeus/preact/version.rb +1 -1
- data/lib/isomorfeus/preact/view_helper.rb +12 -11
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc6778bbf30d6016a228fb502b677f9eced87caa1707f52d44af8731a4d7538a
|
4
|
+
data.tar.gz: 071aa5f4f397feb37909385fc275d5d7e204d8e316d067dbffd6132178ab49bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95a9333d418f75177a14de6d3e751d55c565e67c9593e470f99605304fc061b7042f9092ef7d8bc5d832751c2bcd55645f70be4770806f468305c892716e464e
|
7
|
+
data.tar.gz: 4657aaa4bd4c83c24c859f8bfb7fcdc97fb775921a54a010d5e301ec95034832c8613521afe3029ee8e1cf9c5f5c709733c40ba0cc74e278061c286407a31dde
|
@@ -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,
|
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,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isomorfeus-preact
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 23.9.0.
|
4
|
+
version: 23.9.0.rc11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|
@@ -78,28 +78,28 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - '='
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 23.9.0.
|
81
|
+
version: 23.9.0.rc11
|
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.
|
88
|
+
version: 23.9.0.rc11
|
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.
|
95
|
+
version: 23.9.0.rc11
|
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.
|
102
|
+
version: 23.9.0.rc11
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: benchmark-ips
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|