imported-template icon indicating copy to clipboard operation
imported-template copied to clipboard

"Don't misbehave" error never shows up in Starcounter apps

Open warpech opened this issue 6 years ago • 0 comments

"Don't misbehave" error never shows up in Starcounter apps, because it shows up only when there are 0 templates in the imported document.

However, in case of a Starcounter app, each app creates its own HTML view that should have a <template>, so we need to count the number of templates in every IMPORTED-TEMPLATE-SCOPE.

Secondly, Starcounter's own htmlmerger inserts two <templates> by its own (see lines 344 and 367): https://github.com/Starcounter/level1/blob/0f8258d36f95558596c5744b54e300bc72568bd7/src/Starcounter.Apps.JsonPatch/SystemHandlers.cs#L344-L367

For of these two reasons, a wrong response that comes from the server for a request http://localhost:8080/sc/htmlmerger?Products_0=%2FProducts%2FStarcounter.Authorization.Unauthorized.html:

<template><template is="declarative-shadow-dom"><style>:host{display:block}</style></template></template>
<imported-template-scope scope="Products_0">404 Page Not Found</imported-template-scope>
<template><template is="declarative-shadow-dom"><slot></slot></template></template>

is not seen as wrong by imported-template.

In result, the developer can see an empty screen and does not know what happened:

image

warpech avatar Feb 14 '19 14:02 warpech