mirror of https://github.com/sveltejs/svelte
chore: avoid reporting inspections when an exception occurs (#13601)
* chore: avoid reporting inspections when an exception occurs * add test * revisepull/13640/head
parent
bb245445fc
commit
e21e624fff
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
chore: avoid reporting inspections when an exception occurs
|
@ -0,0 +1,7 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
let { a = $bindable() } = $props();
|
||||||
|
|
||||||
|
$inspect(a).with((t, c) => console.log(t, c));
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<p>{a}</p>
|
@ -0,0 +1,16 @@
|
|||||||
|
import { flushSync } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
compileOptions: {
|
||||||
|
dev: true
|
||||||
|
},
|
||||||
|
|
||||||
|
async test({ assert, target, logs }) {
|
||||||
|
const b1 = target.querySelector('button');
|
||||||
|
b1?.click();
|
||||||
|
flushSync();
|
||||||
|
|
||||||
|
assert.deepEqual(logs, ['init', 'a', 'init', 'b']);
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,13 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import Component from './Component.svelte';
|
||||||
|
|
||||||
|
let s = $state({ a: {"1": "a", "2": "b"} });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button onclick={() => (s = {})}>Set State</button>
|
||||||
|
|
||||||
|
{#if s.a}
|
||||||
|
{#each Object.entries(s.a) as [k, v]}
|
||||||
|
<Component bind:a={s.a[k]} />
|
||||||
|
{/each}
|
||||||
|
{/if}
|
Loading…
Reference in new issue