Skip to content

Commit

Permalink
Update ErrorMessage.js
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsp committed Oct 14, 2024
1 parent cd89d33 commit 72ed59d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions frontend/components/ErrorMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,10 @@ const AnsiUpLine = (/** @type {{value: string}} */ { value }) => {
node_ref.current.innerHTML = new AnsiUp().ansi_to_html(value)
}, [node_ref.current, value])

return value === "" ? html`<p><br /></p>` : html`<p ref=${node_ref}></p>`
// placeholder while waiting for AnsiUp to render, to prevent layout flash
const without_ansi_chars = value.replace(/\u001b\[[0-9;]*m/g, "")

return value === "" ? html`<p><br /></p>` : html`<p ref=${node_ref}>${without_ansi_chars}</p>`
}

export const ErrorMessage = ({ msg, stacktrace, cell_id }) => {
Expand Down Expand Up @@ -559,7 +562,7 @@ const motivational_words = [
"Be patient :)",
// Errors horen erbij
// Ook de pros krijgen errors
...Array(30).fill(null),
...Array(100).fill(null),
]

const Motivation = ({ stacktrace }) => {
Expand Down

0 comments on commit 72ed59d

Please sign in to comment.