Don't show output init timeout message on serialization error (#1096)

This commit is contained in:
Jonatan Kłosko 2022-04-09 15:48:44 +02:00 committed by GitHub
parent d567adaa17
commit 8b17365bf9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View file

@ -95,8 +95,8 @@ const JSView = {
const errorRef = this.channel.on( const errorRef = this.channel.on(
`error:${this.props.ref}`, `error:${this.props.ref}`,
({ message }) => { ({ message, init }) => {
this.handleServerError(message); this.handleServerError(message, init);
} }
); );
@ -334,7 +334,11 @@ const JSView = {
}); });
}, },
handleServerError(message) { handleServerError(message, init) {
if (init) {
this.clearInitTimeout();
}
if (!this.errorContainer) { if (!this.errorContainer) {
this.errorContainer = document.createElement("div"); this.errorContainer = document.createElement("div");
this.errorContainer.classList.add("error-box", "mb-4"); this.errorContainer.classList.add("error-box", "mb-4");

View file

@ -70,7 +70,7 @@ defmodule LivebookWeb.JSViewChannel do
with {:error, error} <- try_push(socket, "init:#{ref}:#{id}", nil, payload) do with {:error, error} <- try_push(socket, "init:#{ref}:#{id}", nil, payload) do
message = "Failed to serialize initial widget data, " <> error message = "Failed to serialize initial widget data, " <> error
push(socket, "error:#{ref}", %{"message" => message}) push(socket, "error:#{ref}", %{"message" => message, "init" => true})
end end
{:noreply, socket} {:noreply, socket}