Skip to content

Commit

Permalink
fix: fix file rename breaking
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Apr 26, 2024
1 parent 331588a commit caace63
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,9 @@ export function useStore(
}

function init() {
watchEffect(() =>
compileFile(store, activeFile.value).then(
(errs) => (errors.value = errs),
),
)
watchEffect(() => {
compileFile(store, activeFile.value).then((errs) => (errors.value = errs))
})

watch(
() => [
Expand Down Expand Up @@ -218,8 +216,11 @@ export function useStore(
if (mainFile.value === oldFilename) {
mainFile.value = newFilename
}

compileFile(store, file).then((errs) => (errors.value = errs))
if (activeFilename.value === oldFilename) {
activeFilename.value = newFilename
} else {
compileFile(store, file).then((errs) => (errors.value = errs))
}
}
const getImportMap: Store['getImportMap'] = () => {
try {
Expand Down

0 comments on commit caace63

Please sign in to comment.