svelte-on-rails 19.2.0 → 19.2.2
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 +3 -2
- 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: 64fab65b35eaba112765f7d99ae3026a75bc25bb907618ca15b8b5f9fbf6f86e
|
|
4
|
+
data.tar.gz: 22e6c0907a069dab0f84f3a8391309bad6418cd0b996321bc1c2f9cdb9fd4ea4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c5c22b14278bebb7818730221a3508f3baaa87a411ff65dcd144bcf2472a676206ac15b245556a20fbb3e54297b22b71043552c0052dbdf345bb9583b4ac82c8
|
|
7
|
+
data.tar.gz: 306019a8aca724942b7460e4ba3d741eed67e211ee9dbb317768f06897940fc349c74bf2d764c791b16dd0eef682a59ab6afb1ce16e6ce005b2de685e7db3c29
|
|
@@ -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
|
|
@@ -165,7 +166,7 @@ module SvelteOnRails
|
|
|
165
166
|
# render
|
|
166
167
|
|
|
167
168
|
res = if @cached_content
|
|
168
|
-
msg = "returned from cache"
|
|
169
|
+
msg = "returned from cache#{", with uncached props" if @props.key?(:_uncached)}"
|
|
169
170
|
@cached_content.html_safe
|
|
170
171
|
else
|
|
171
172
|
msg = "Rendered"
|
|
@@ -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).html_safe
|
|
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)
|