Skip to content

Commit add7b2f

Browse files
committed
Address JS feedback
1 parent d091ebd commit add7b2f

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

js/markdown-stream/markdown-stream.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,9 @@ class MarkdownElement extends LightElement {
219219

220220
// ------- Register custom elements and shiny bindings ---------
221221

222-
customElements.get("shiny-markdown-stream") ||
222+
if (!customElements.get("shiny-markdown-stream")) {
223223
customElements.define("shiny-markdown-stream", MarkdownElement);
224+
}
224225

225226
function handleMessage(message: ContentMessage | IsStreamingMessage): void {
226227
const el = document.getElementById(message.id) as MarkdownElement;
@@ -230,7 +231,7 @@ function handleMessage(message: ContentMessage | IsStreamingMessage): void {
230231
status: "error",
231232
message: `Unable to handle MarkdownStream() message since element with id
232233
${message.id} wasn't found. Do you need to call .ui() (Express) or need a
233-
output_markdown_stream('${message.id}') in the UI (Core)?`,
234+
markdown_stream_ui('${message.id}') in the UI (Core)?`,
234235
});
235236
return;
236237
}
@@ -246,7 +247,7 @@ function handleMessage(message: ContentMessage | IsStreamingMessage): void {
246247
const content = el.getAttribute("content");
247248
el.setAttribute("content", content + message.content);
248249
} else {
249-
console.error(`Unknown operation: ${message.operation}`);
250+
throw new Error(`Unknown operation: ${message.operation}`);
250251
}
251252
}
252253

shiny/www/py-shiny/markdown-stream/markdown-stream.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

shiny/www/py-shiny/markdown-stream/markdown-stream.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)