svelte-on-rails 19.2.0 → 19.2.1
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/svelte_on_rails/lib/view_helper_support.rb +2 -1
- data/lib/svelte_on_rails/view_helpers.rb +17 -11
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 31953de9154c42d7d9a7bae72488edb67db97fe643a1ef6bd0147c97c218d01f
|
|
4
|
+
data.tar.gz: a3aeb775d928ef33535de12ecb3dda75636e181d69cd224b2bc005a508221313
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 326eef7533539d6b7cf698a77f6ae826e90b463935e96012f105c2fca2783d4942ba8e40981e9fb57b453fc72d0e97c65fb0b392f3ef5ec78e1d9ab81a1b9514
|
|
7
|
+
data.tar.gz: 3d92de0816c04a57647f2de6222d721f4127d116cb9602a2778c5f91c923f7ff8e3ec57e15442a1df33f23088443b096a2cf6b12cbe79beb225d7a5a8d9e47ae
|
|
@@ -4,6 +4,7 @@ module SvelteOnRails
|
|
|
4
4
|
module Lib
|
|
5
5
|
class ViewHelperSupport
|
|
6
6
|
|
|
7
|
+
UNCACHED_PROPS_PLACEHOLDER = "**UNCACHED_PROPS_PLACEHOLDER_VDKVUKCYPTHQ4R6Z4EJ**"
|
|
7
8
|
RENDER_OPTIONS = { ssr: [true, false, :auto], hydrate: :bool, debug: :bool, cache_key: :string_array, expires_in: :integer, cached: :bool }
|
|
8
9
|
attr_reader :conf
|
|
9
10
|
|
|
@@ -22,7 +23,7 @@ module SvelteOnRails
|
|
|
22
23
|
@view_dir = view_dir
|
|
23
24
|
@request = request
|
|
24
25
|
@props = if props.key?(:_uncached)
|
|
25
|
-
props.merge(_uncached:
|
|
26
|
+
props.merge(_uncached: UNCACHED_PROPS_PLACEHOLDER)
|
|
26
27
|
else
|
|
27
28
|
props
|
|
28
29
|
end
|
|
@@ -30,17 +30,23 @@ module SvelteOnRails
|
|
|
30
30
|
)
|
|
31
31
|
|
|
32
32
|
if support.ssr?
|
|
33
|
-
if config.watch_changes? && !config.build_status['passed']
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
res = if config.watch_changes? && !config.build_status['passed']
|
|
34
|
+
sor_error_tag(support, wrapper_html, component_props, 'server-side-svelte-build-error', 'SVELTE BUILD FAILED')
|
|
35
|
+
elsif caching
|
|
36
|
+
support.set_request_metrics(:from_cache)
|
|
37
|
+
support.render_cached(self) do
|
|
38
|
+
render_component(support, wrapper_html, component_props)
|
|
39
|
+
end
|
|
40
|
+
else
|
|
41
|
+
r = render_component(support, wrapper_html, component_props)
|
|
42
|
+
support.log_completed("Rendered #{'as empty element that will be mounted on the client side' unless support.ssr?}")
|
|
43
|
+
r
|
|
44
|
+
end
|
|
45
|
+
if component_props.key?(:_uncached)
|
|
46
|
+
u_prp = CGI.escapeHTML(component_props[:_uncached].to_json)
|
|
47
|
+
res.sub(""**UNCACHED_PROPS_PLACEHOLDER_VDKVUKCYPTHQ4R6Z4EJ**"", u_prp)
|
|
40
48
|
else
|
|
41
|
-
|
|
42
|
-
support.log_completed("Rendered #{'as empty element that will be mounted on the client side' unless support.ssr?}")
|
|
43
|
-
r
|
|
49
|
+
res
|
|
44
50
|
end
|
|
45
51
|
else
|
|
46
52
|
render_empty_tag(support, wrapper_html, component_props)
|
|
@@ -71,7 +77,7 @@ module SvelteOnRails
|
|
|
71
77
|
|
|
72
78
|
if ssr_result[:success]
|
|
73
79
|
support.set_request_metrics(:rendered)
|
|
74
|
-
attr = support.tag_attributes(html_options,
|
|
80
|
+
attr = support.tag_attributes(html_options, support.props)
|
|
75
81
|
content_tag(:div, attr) do
|
|
76
82
|
concat(ssr_result[:head].html_safe)
|
|
77
83
|
concat(ssr_result[:html].html_safe)
|