mirror of https://github.com/sveltejs/svelte
parent
aaa1797ed8
commit
2017af407d
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: ensure computed props are cached with derived
|
@ -0,0 +1,7 @@
|
||||
<script>
|
||||
let { random } = $props();
|
||||
</script>
|
||||
|
||||
<p>{random}</p>
|
||||
<p>{random}</p>
|
||||
<p>{random}</p>
|
@ -0,0 +1,21 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
let math_random = Math.random;
|
||||
let calls = 0;
|
||||
|
||||
export default test({
|
||||
skip_if_hydrate: 'permanent',
|
||||
before_test() {
|
||||
Math.random = function () {
|
||||
calls++;
|
||||
return math_random.call(this);
|
||||
};
|
||||
},
|
||||
after_test() {
|
||||
Math.random = math_random;
|
||||
calls = 0;
|
||||
},
|
||||
test({ assert }) {
|
||||
assert.equal(calls, 1);
|
||||
}
|
||||
});
|
@ -0,0 +1,5 @@
|
||||
<script>
|
||||
import Child from './Child.svelte';
|
||||
</script>
|
||||
|
||||
<Child random={Math.random().toFixed(2)} />
|
Loading…
Reference in new issue