isomorfeus-preact 10.6.41 → 10.6.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/isomorfeus/preact_view_helper.rb +15 -11
- data/lib/isomorfeus/ssr.rb +19 -0
- data/lib/isomorfeus/top_level_ssr.rb +6 -0
- data/lib/preact/version.rb +1 -1
- data/lib/preact.rb +1 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3363983634e71069a60fa277a03d0394993690dcf7cab706fb8a28fc22367072
|
4
|
+
data.tar.gz: d8a9855c74eb31e3de87dba1c5bd5c5362a6f2cda93d7bbcb42e8b1ceec6d7ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a2e5544a14afdb95e1ca54a679285fffffacb9d25b8c8ab7971acd70d71221fde8b4c28733ee0aa4ca8900226653db6273de1d1d14552214a7c8458e6f51b88
|
7
|
+
data.tar.gz: 2cf4331a001fce697899ebaacb409a50a8d1873efad53f52ebf4612cac50f02f8616eac13b9ab62518417f78503c7077750f8fc5a361ff53e3c4d36a865f4bce
|
@@ -27,7 +27,12 @@ module Isomorfeus
|
|
27
27
|
begin
|
28
28
|
init_speednode_context(asset_key, thread_id_asset)
|
29
29
|
rescue Exception => e
|
30
|
-
|
30
|
+
if e.message.include?('@hash[:js][:js][:raw]') # asset bundling did not yet finish
|
31
|
+
sleep 2
|
32
|
+
return mount_component(component_name, props, asset_key, skip_ssr: skip_ssr, use_ssr: use_ssr, max_passes: max_passes)
|
33
|
+
else
|
34
|
+
Isomorfeus.raise_error(message: "Server Side Rendering: Failed creating context for #{asset_key}. Error: #{e.message}", stack: e.backtrace)
|
35
|
+
end
|
31
36
|
end
|
32
37
|
else
|
33
38
|
unless Isomorfeus.ssr_contexts.key?(thread_id_asset)
|
@@ -37,8 +42,7 @@ module Isomorfeus
|
|
37
42
|
|
38
43
|
ctx = Isomorfeus.ssr_contexts[thread_id_asset]
|
39
44
|
pass = 0
|
40
|
-
# if location_host and scheme are given and if Transport is loaded, connect and then render
|
41
|
-
# otherwise do not render because only one pass is required
|
45
|
+
# if location_host and scheme are given and if Transport is loaded, connect and then render
|
42
46
|
ws_scheme = props[:location_scheme] == 'https:' ? 'wss:' : 'ws:'
|
43
47
|
location_host = props[:location_host] ? props[:location_host] : 'localhost'
|
44
48
|
api_ws_path = Isomorfeus.respond_to?(:api_websocket_path) ? Isomorfeus.api_websocket_path : ''
|
@@ -110,11 +114,11 @@ module Isomorfeus
|
|
110
114
|
Isomorfeus.raise_error(message: "Server Side Rendering: #{exception['message']}", stack: exception['stack']) if exception
|
111
115
|
if need_further_pass && script_key
|
112
116
|
break if (Time.now - start_time) > 5
|
113
|
-
|
114
|
-
while
|
115
|
-
break if (Time.now - start_time) >
|
116
|
-
sleep 0.
|
117
|
-
|
117
|
+
still_busy = ctx.eval_script(key: script_key)
|
118
|
+
while still_busy
|
119
|
+
break if (Time.now - start_time) > 5
|
120
|
+
sleep 0.005
|
121
|
+
still_busy = ctx.eval_script(key: script_key)
|
118
122
|
end
|
119
123
|
break if pass >= max_passes
|
120
124
|
else
|
@@ -179,10 +183,10 @@ module Isomorfeus
|
|
179
183
|
ctx.exec(ssr_mod)
|
180
184
|
ctx.add_script(key: :first_pass_check, source: '[global.FirstPassFinished, global.NeedFurtherPass, global.Exception ? { message: global.Exception.message, stack: global.Exception.stack } : false ]')
|
181
185
|
ctx.add_script(key: :first_pass_result, source: 'Opal.Isomorfeus.SSR.first_pass_result()')
|
182
|
-
ctx.add_script(key: :still_busy, source: '
|
183
|
-
ctx.add_script(key: :store_busy, source: '
|
186
|
+
ctx.add_script(key: :still_busy, source: 'Opal.Isomorfeus.SSR.still_busy()')
|
187
|
+
ctx.add_script(key: :store_busy, source: 'Opal.Isomorfeus.SSR.store_busy()')
|
184
188
|
ctx.add_script(key: :transport_busy, source: 'global.Opal.Isomorfeus.Transport["$busy?"]()')
|
185
|
-
ctx.add_script(key: :transport_disconnect, source: 'global.Opal.Isomorfeus.
|
189
|
+
ctx.add_script(key: :transport_disconnect, source: 'global.Opal.Isomorfeus.SSR.$disconnect_transport()')
|
186
190
|
end
|
187
191
|
end
|
188
192
|
|
data/lib/isomorfeus/ssr.rb
CHANGED
@@ -70,6 +70,25 @@ module Isomorfeus
|
|
70
70
|
global.NeedFurtherPass = (nfp == nil) ? false : nfp;
|
71
71
|
return [rendered_tree, application_state, ssr_styles, global.Opal.Isomorfeus['$ssr_response_status'](), global.NeedFurtherPass, global.Exception ? { message: global.Exception.message, stack: global.Exception.stack } : false];
|
72
72
|
}
|
73
|
+
|
74
|
+
self.still_busy = function(){
|
75
|
+
if (global.Opal.Isomorfeus.Transport["$busy?"]()) { return true; }
|
76
|
+
return self.store_busy();
|
77
|
+
}
|
78
|
+
|
79
|
+
self.store_busy = function() {
|
80
|
+
let nfp = global.Opal.Isomorfeus.store["$recently_dispatched?"]();
|
81
|
+
return (nfp == global.Opal.nil) ? false : nfp;
|
82
|
+
}
|
73
83
|
}
|
84
|
+
|
85
|
+
def self.disconnect_transport
|
86
|
+
Isomorfeus::Transport::RequestAgent.agents.each do |agent_id, agent|
|
87
|
+
agent.promise.reject() unless agent.promise.realized?
|
88
|
+
Isomorfeus::Transport::RequestAgent.del!(agent_id)
|
89
|
+
end
|
90
|
+
Isomorfeus::Transport.instance_variable_set(:@requests_in_progress, { requests: {}, agent_ids: {} })
|
91
|
+
Isomorfeus::Transport.disconnect
|
92
|
+
end
|
74
93
|
end
|
75
94
|
end
|
data/lib/preact/version.rb
CHANGED
data/lib/preact.rb
CHANGED
@@ -294,11 +294,7 @@ module Preact
|
|
294
294
|
end
|
295
295
|
end
|
296
296
|
|
297
|
-
|
298
|
-
def self.render_to_string(native_preact_element)
|
299
|
-
`Opal.global.Preact.renderToString(native_preact_element)`
|
300
|
-
end
|
301
|
-
end
|
297
|
+
# render_to_string is in top_level_ssr.rb
|
302
298
|
|
303
299
|
def self.unmount_component_at_node(element_or_query)
|
304
300
|
if `(typeof element_or_query === 'string')` || (`(typeof element_or_query.$class === 'function')` && element_or_query.class == String)
|
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: 10.6.
|
4
|
+
version: 10.6.45
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|