Skip to content

Commit

Permalink
Update computedSfc.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Dec 20, 2024
1 parent eb989b3 commit 8e632b8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/language-core/lib/virtualFile/computedSfc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,15 @@ export function computedSfc(
const content = computed(() => {
return snapshot.get().getText(0, snapshot.get().getLength());
});
const comments = computed(() => {
return parsed.get()?.descriptor.comments ?? [];
const comments = computed<string[]>(oldValue => {
const newValue = parsed.get()?.descriptor.comments ?? [];
if (
oldValue?.length === newValue.length
&& oldValue.every((v, i) => v === newValue[i])
) {
return oldValue;
}
return newValue;
});
const template = computedNullableSfcBlock(
'template',
Expand Down

0 comments on commit 8e632b8

Please sign in to comment.