diff --git a/starcounter-include.html b/starcounter-include.html
index 121347f..3562d44 100644
--- a/starcounter-include.html
+++ b/starcounter-include.html
@@ -310,27 +310,30 @@
return this._renderCompositionChange(compositionProviderComposition, () => {
// convert string from view-model, to actual document fragment
const customComposition = this.stringToDocumentFragment(compositionProviderComposition);
-
+
// append default compositions for views not covered by this composition
- if (compositionProvider.ViewUris) {
- const keys = Object.keys(this.viewModel);
- for(let key of keys) {
- const scoped = this.viewModel[key];
- if (scoped && scoped.Html && compositionProvider.ViewUris.indexOf(scoped.Html) === -1) {
- if (this.defaultComposition) {
- this.template.scopedNodes.forEach((nodes) => {
- if(nodes.scope === key) {
- nodes.forEach((node) => appendComposition(customComposition, node));
- }
- });
- }
- else {
- // BUG,TODO (tomalec): looks like a bug
- // This means that if there *is* a custom composition, but it does not cover all views,
- // and it happend that none of the views had a default composition,
- // we would discard custom composition and use default -> fallback
- return false;
- }
+ const defaultViewHtmlsToBeRendered =
+ compositionProvider.ActualViewUris.filter(
+ x => !compositionProvider.ViewUris.includes(x.hasOwnProperty("BlendingUri") ? x.BlendingUri : x))
+ .map(x => x.hasOwnProperty("ViewHtml") ? x.ViewHtml : x);
+
+ const keys = Object.keys(this.viewModel);
+ for (let key of keys) {
+ const scoped = this.viewModel[key];
+ if (scoped && scoped.Html && defaultViewHtmlsToBeRendered.includes(scoped.Html)) {
+ if (this.defaultComposition) {
+ this.template.scopedNodes.forEach((nodes) => {
+ if (nodes.scope === key) {
+ nodes.forEach((node) => appendComposition(customComposition, node));
+ }
+ });
+ }
+ else {
+ // BUG,TODO (tomalec): looks like a bug
+ // This means that if there *is* a custom composition, but it does not cover all views,
+ // and it happend that none of the views had a default composition,
+ // we would discard custom composition and use default -> fallback
+ return false;
}
}
}
diff --git a/test/composition/default-declarative-shadow-dom.html b/test/composition/default-declarative-shadow-dom.html
index 26ba5f8..18555c4 100644
--- a/test/composition/default-declarative-shadow-dom.html
+++ b/test/composition/default-declarative-shadow-dom.html
@@ -65,7 +65,8 @@
Custom Shadow DOM alternative composition
"CompositionProvider_0": {
"PartialId": "given PartialId",
"Composition": "",
- "ViewUris": []
+ "ViewUris": [],
+ "ActualViewUris": ["template_w_declarative-shadow-dom-alternative.html"]
},
"App": {
"Html": "template_w_declarative-shadow-dom-alternative.html",
@@ -76,7 +77,8 @@ Custom Shadow DOM alternative composition
"CompositionProvider_0": {
"PartialId": "given PartialId",
"Composition": "custom!",
- "ViewUris": ["template_w_declarative-shadow-dom.html"]
+ "ViewUris": ["template_w_declarative-shadow-dom.html"],
+ "ActualViewUris": ["template_w_declarative-shadow-dom.html", "template_w_declarative-shadow-dom-alternative.html"]
},
"App1": {
"Html": "template_w_declarative-shadow-dom.html",
diff --git a/test/composition/parent-declarative-shadow-dom.html b/test/composition/parent-declarative-shadow-dom.html
index ae07434..90f7ca5 100644
--- a/test/composition/parent-declarative-shadow-dom.html
+++ b/test/composition/parent-declarative-shadow-dom.html
@@ -73,7 +73,8 @@ Custom Shadow DOM alternative composition
"CompositionProvider_0": {
"PartialId": "given PartialId",
"Composition": "",
- "ViewUris": []
+ "ViewUris": [],
+ "ActualViewUris": ["template_w_declarative-shadow-dom-alternative.html"]
},
"App": {
"Html": "template_w_declarative-shadow-dom-alternative.html",
@@ -84,7 +85,8 @@ Custom Shadow DOM alternative composition
"CompositionProvider_0": {
"PartialId": "given PartialId",
"Composition": "custom!",
- "ViewUris": ["template_w_declarative-shadow-dom.html"]
+ "ViewUris": ["template_w_declarative-shadow-dom.html"],
+ "ActualViewUris": ["template_w_declarative-shadow-dom.html", "template_w_declarative-shadow-dom-alternative.html"]
},
"App1": {
"Html": "template_w_declarative-shadow-dom.html",
diff --git a/test/view-model-attribute/cleanup_removed_partial_Layout.html b/test/view-model-attribute/cleanup_removed_partial_Layout.html
index 2007c4e..c448e23 100644
--- a/test/view-model-attribute/cleanup_removed_partial_Layout.html
+++ b/test/view-model-attribute/cleanup_removed_partial_Layout.html
@@ -1,4 +1,4 @@
-
+
@@ -36,7 +36,9 @@
"CompositionProvider_0": {
"Html": "../templateToInclude.html",
"Composition": 'a Composition',
- "PartialId": "given PartialId"
+ "PartialId": "given PartialId",
+ "ViewUris": [""],
+ "ActualViewUris": [""]
},
"doesItWork": "works!"
};
diff --git a/test/view-model-attribute/nested-html/stamped_from_polymer_template.html b/test/view-model-attribute/nested-html/stamped_from_polymer_template.html
index d0dfe8e..7333482 100644
--- a/test/view-model-attribute/nested-html/stamped_from_polymer_template.html
+++ b/test/view-model-attribute/nested-html/stamped_from_polymer_template.html
@@ -1,4 +1,4 @@
-
+
@@ -42,7 +42,9 @@
},
'CompositionProvider_0': {
'Composition': 'custom composition',
- 'doesItWork': 'works!'
+ 'doesItWork': 'works!',
+ "ViewUris": [""],
+ "ActualViewUris": [""]
}
};
};