You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A small but irritating error here - if I call console.warn({"abc": "def"}) anywhere in my Svelte app after I have opened a view that uses SvelteMarkdown I get the following error message:
Uncaught TypeError: message.includes is not a function
warn supress-warnings.js:7
The cause is the following code from supress-warnings.js:
import { onMount } from 'svelte'
export function supressWarnings() {
const origWarn = console.warn
console.warn = (message) => {
if (message.includes('unknown prop')) return
if (message.includes('unexpected slot')) return
origWarn(message)
}
onMount(() => {
console.warn = origWarn
})
}
As you might imagine, the includes property doesn't exist on arbitrary objects so it fails there - a simple message.hasOwnProperty("includes") check would fix this.
It does look as though the supressWarnings function should only be active until onMount completes, so I wonder if there's something else going on here, but at the very least that would prevent it from breaking things worse when a warning is raised.
The text was updated successfully, but these errors were encountered:
A small but irritating error here - if I call
console.warn({"abc": "def"})
anywhere in my Svelte app after I have opened a view that uses SvelteMarkdown I get the following error message:The cause is the following code from
supress-warnings.js
:As you might imagine, the
includes
property doesn't exist on arbitrary objects so it fails there - a simplemessage.hasOwnProperty("includes")
check would fix this.It does look as though the
supressWarnings
function should only be active untilonMount
completes, so I wonder if there's something else going on here, but at the very least that would prevent it from breaking things worse when a warning is raised.The text was updated successfully, but these errors were encountered: