Skip to content

Commit 3ed4265

Browse files
committed
fix(language-core): avoid incorrect offset updates caused by computed side effects
1 parent 548e158 commit 3ed4265

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/language-core/lib/virtualFile/computedSfc.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,10 @@ export function computedSfc(
299299
return computed(() => {
300300
const val = getBlock()[key] as SfcBlockAttr | undefined;
301301
if (typeof val === 'object') {
302-
val.offset = base.start + val.offset;
302+
return {
303+
...val,
304+
offset: base.start + val.offset,
305+
};
303306
}
304307
return val;
305308
});

0 commit comments

Comments
 (0)