fix: correct migration of uninitialised state (#13673)

* fix: correct migration of uninitialised state

* better fix
pull/13678/head
Dominic Gannaway 2 months ago committed by GitHub
parent 0598f2bbe1
commit f398929fdd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: correct migration of uninitialised state

@ -564,7 +564,12 @@ const instance_script = {
labeled_statement = /** @type {LabeledStatement} */ (labeled); labeled_statement = /** @type {LabeledStatement} */ (labeled);
} }
return !update && (declaration || (labeled && assignment) || (!labeled && !assignment)); return (
!update &&
((declaration && binding.initial) ||
(labeled && assignment) ||
(!labeled && !assignment))
);
}) })
); );

@ -0,0 +1,13 @@
<script lang="ts">
let bounds: DOMRect | undefined;
$: position = calculatePosition(bounds);
const openDropdown = () => {
bounds = getInputPosition();
};
const getInputPosition = () => {};
const calculatePosition = (boundary?: DOMRect) => ({});
</script>
<div style:top={position.top}></div>

@ -0,0 +1,13 @@
<script lang="ts">
let bounds: DOMRect | undefined = $state();
const openDropdown = () => {
bounds = getInputPosition();
};
const getInputPosition = () => {};
const calculatePosition = (boundary?: DOMRect) => ({});
let position = $derived(calculatePosition(bounds));
</script>
<div style:top={position.top}></div>
Loading…
Cancel
Save