Skip to content

Commit caace63

Browse files
committed
fix: fix file rename breaking
1 parent 331588a commit caace63

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/store.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,9 @@ export function useStore(
6464
}
6565

6666
function init() {
67-
watchEffect(() =>
68-
compileFile(store, activeFile.value).then(
69-
(errs) => (errors.value = errs),
70-
),
71-
)
67+
watchEffect(() => {
68+
compileFile(store, activeFile.value).then((errs) => (errors.value = errs))
69+
})
7270

7371
watch(
7472
() => [
@@ -218,8 +216,11 @@ export function useStore(
218216
if (mainFile.value === oldFilename) {
219217
mainFile.value = newFilename
220218
}
221-
222-
compileFile(store, file).then((errs) => (errors.value = errs))
219+
if (activeFilename.value === oldFilename) {
220+
activeFilename.value = newFilename
221+
} else {
222+
compileFile(store, file).then((errs) => (errors.value = errs))
223+
}
223224
}
224225
const getImportMap: Store['getImportMap'] = () => {
225226
try {

0 commit comments

Comments
 (0)