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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d011f929a4ffd6de0381a91faf504e01e23fc453e94da2a5fff8f2ab25d87fa
4
- data.tar.gz: 78c81f24932af0b529cd7f7fcd6891d989f70f3895898be837e6399e99ff1bda
3
+ metadata.gz: 31953de9154c42d7d9a7bae72488edb67db97fe643a1ef6bd0147c97c218d01f
4
+ data.tar.gz: a3aeb775d928ef33535de12ecb3dda75636e181d69cd224b2bc005a508221313
5
5
  SHA512:
6
- metadata.gz: 4250d8c038ddf7d3a872bedfd9f359d93a2fb0c05bf6b1d1ae31ca84d83854748a3d7655975e69cd1f58568eabbdf7139e0db5f1976823d0c03d2ebd3c1822c0
7
- data.tar.gz: 3d1a995dc1f093f0e19fb420a710e998294563cd5252166149c9eafea3ca1778c13d00b707b04e450ad19e27cacbc9882908aa22d96b28af8cfa082c5449e043
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: "Uncached props are available for hydration but not for server-side rendering.")
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
- 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
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
- 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
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, component_props)
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svelte-on-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 19.2.0
4
+ version: 19.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Sedlmair