Skip to content

Commit 340f35c

Browse files
authored
Merge pull request #85 from basemate/implementing_issue_75
added information to docs and raise specific error in order to inform…
2 parents b811cb3 + e0e02be commit 340f35c

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

app/concepts/matestack/ui/core/page/page.rb

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,25 +82,28 @@ def show(component_key=nil, only_page=false)
8282

8383
when :only_page
8484
nodes_to_cell
85-
# keys_array = ["div_2","components", "partial_1", "components", "form_1"]
86-
# puts @nodes.dig(*keys_array)
8785
render :page
8886
when :render_page_with_app
8987
concept(@app_class).call(:show, @page_id, @nodes)
9088
when :render_component
91-
if component_key.include?("__")
92-
keys_array = component_key.gsub("__", "__components__").split("__").map {|k| k.to_s}
93-
page_content_keys = keys_array.select{|key| key.match(/^page_content_/)}
94-
if page_content_keys.any?
95-
keys_array = keys_array.drop(keys_array.find_index(page_content_keys[0])+2)
89+
begin
90+
if component_key.include?("__")
91+
keys_array = component_key.gsub("__", "__components__").split("__").map {|k| k.to_s}
92+
page_content_keys = keys_array.select{|key| key.match(/^page_content_/)}
93+
if page_content_keys.any?
94+
keys_array = keys_array.drop(keys_array.find_index(page_content_keys[0])+2)
95+
end
96+
node = @nodes.dig(*keys_array)
97+
cell = to_cell(component_key, node["component_name"], node["config"], node["argument"], node["components"], node["included_config"])
98+
return cell.render_content
99+
else
100+
node = @nodes[component_key]
101+
cell = to_cell(component_key, node["component_name"], node["config"], node["argument"], node["components"], node["included_config"])
102+
return cell.render_content
96103
end
97-
node = @nodes.dig(*keys_array)
98-
cell = to_cell(component_key, node["component_name"], node["config"], node["argument"], node["components"], node["included_config"])
99-
return cell.render_content
100-
else
101-
node = @nodes[component_key]
102-
cell = to_cell(component_key, node["component_name"], node["config"], node["argument"], node["components"], node["included_config"])
103-
return cell.render_content
104+
rescue
105+
raise "Component '#{component_key}' could not be resolved. Notice: Rerendering currently works only on page-level. \
106+
You are therefore currently not able to use 'async' within a component for example!"
104107
end
105108
end
106109
end

docs/components/async.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ As the name suggests, the async component allows us to let our components behave
66

77
Please be aware that, if not configured otherwise, the async core component does get loaded and displayed on initial pageload!
88

9+
**the async component currently only works on page-level --> we're working on it in order support the usage of async within a component [#75](https://github.com/basemate/matestack-ui-core/issues/75)**
10+
911
## Parameters
1012

1113
The async core component accepts the following parameters:

0 commit comments

Comments
 (0)