mirror of https://github.com/sveltejs/svelte
breaking: remove unstate(), replace with $state.snapshot rune (#11180)
* breaking: remove untrack(), replace with $state.clean rune * lol * update types * update types * undo * undo * rename to raw * rename to snapshot * fix * tweak docs, to make it explicitly that we're converting to and from proxies * remove vestiges * validation * tweak --------- Co-authored-by: Rich Harris <rich.harris@vercel.com>pull/11186/head
parent
cd7c3fea16
commit
18097478fc
@ -0,0 +1,5 @@
|
||||
---
|
||||
"svelte": patch
|
||||
---
|
||||
|
||||
breaking: remove unstate(), replace with $state.snapshot rune
|
@ -0,0 +1,8 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
error: {
|
||||
code: 'invalid-rune-args-length',
|
||||
message: '$state.snapshot can only be called with 1 argument'
|
||||
}
|
||||
});
|
@ -0,0 +1,3 @@
|
||||
<script>
|
||||
const foo = $state.snapshot();
|
||||
</script>
|
@ -1,7 +1,5 @@
|
||||
<script>
|
||||
import { unstate } from 'svelte';
|
||||
|
||||
let items = $state([{a: 0}]);
|
||||
</script>
|
||||
|
||||
<button on:click={() => items.push({a: items.length})}>{JSON.stringify(structuredClone(unstate(items)))}</button>
|
||||
<button on:click={() => items.push({a: items.length})}>{JSON.stringify(structuredClone($state.snapshot(items)))}</button>
|
Loading…
Reference in new issue