fix: ensure $inspect.trace works correctly with null values

pull/14853/head
Dominic Gannaway 2 years ago
parent 7f8acb8a37
commit eb7dd3c656

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: ensure $inspect.trace works correctly with null values

@ -51,7 +51,9 @@ function log_entry(signal, entry) {
status !== 'clean'
? 'color: CornflowerBlue; font-weight: bold'
: 'color: grey; font-weight: bold',
typeof value === 'object' && STATE_SYMBOL in value ? snapshot(value, true) : value
typeof value === 'object' && value !== null && STATE_SYMBOL in value
? snapshot(value, true)
: value
);
if (type === '$derived') {

@ -0,0 +1,11 @@
import { test, ok } from '../../test';
export default test({
html: `<svg viewBox="0 0 16 16"><title></title><path d="M8 0C3.589 0 0 3.589 0 8s3.589 8 8 8 8-3.589 8-8-3.589-8-8-8zm0 15c-3.86 0-7-3.14-7-7s3.14-7 7-7 7 3.14 7 7-3.14 7-7 7z"></path><path d="M11.146 5.388L6.982 9.552 4.839 7.409c-.195-.195-.512-.195-.707 0-.195.195-.195.512 0 .707l2.496 2.496c.195.195.512.195.707 0l4.518-4.518c.195-.195.195-.512 0-.707-.195-.195-.511-.195-.707.001z"></path></svg>`,
test({ assert, target }) {
const title = target.querySelector('title');
ok(title);
assert.equal(title.namespaceURI, 'http://www.w3.org/2000/svg');
}
});

@ -0,0 +1,11 @@
<script>
let title = 'Circle with checkmark';
</script>
<svg viewBox="0 0 16 16" aria-hidden={title ? null : "true"}>
{#if title}
<title>{title}</title>
{/if}
<path d="M8 0C3.589 0 0 3.589 0 8s3.589 8 8 8 8-3.589 8-8-3.589-8-8-8zm0 15c-3.86 0-7-3.14-7-7s3.14-7 7-7 7 3.14 7 7-3.14 7-7 7z"></path>
<path d="M11.146 5.388L6.982 9.552 4.839 7.409c-.195-.195-.512-.195-.707 0-.195.195-.195.512 0 .707l2.496 2.496c.195.195.512.195.707 0l4.518-4.518c.195-.195.195-.512 0-.707-.195-.195-.511-.195-.707.001z"></path>
</svg>
Loading…
Cancel
Save