fix: ensure each block references to imports are handled correctly (#13892)

pull/13895/head
Dominic Gannaway 5 months ago committed by GitHub
parent 59ff7f1e88
commit 4cf2d4a904
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: ensure each block references to imports are handled correctly

@ -505,7 +505,11 @@ export function analyze_component(root, source, options) {
if (is_reference(node, parent)) {
const binding = context.state.scope.get(node.name);
if (binding && binding.kind === 'normal') {
if (
binding &&
binding.kind === 'normal' &&
binding.declaration_kind !== 'import'
) {
binding.kind = 'state';
binding.mutated = binding.updated = true;
}

@ -0,0 +1,6 @@
import { test } from '../../test';
export default test({
html: `<input type="text">`,
ssrHtml: `<input type="text" value="">`
});

@ -0,0 +1,7 @@
<script>
import { foo } from './utils';
</script>
{#each foo.bar as bar}
<input type="text" bind:value={bar.value} />
{/each}

@ -0,0 +1,9 @@
export const foo = {
get bar() {
return [
{
value: ''
}
];
}
};
Loading…
Cancel
Save