Skip to content

Commit

Permalink
fix: improve story/md deletion handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Oct 2, 2022
1 parent 709ee34 commit e85af38
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/histoire-app/src/app/stores/folder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ export const useFolderStore = defineStore('folder', () => {
const storyStore = useStoryStore()

watch(() => storyStore.currentStory, (story) => {
openFileFolders(story.file.path)
if (story) {
openFileFolders(story.file.path)
}
})

return {
Expand Down
5 changes: 4 additions & 1 deletion packages/histoire/src/node/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ export const relativePath = ${JSON.stringify(relativePath)}
if (import.meta.hot) {
import.meta.hot.accept(newModule => {
window.__hst_md_hmr(newModule)
if (newModule) {
window.__hst_md_hmr(newModule)
}
})
}`
}
Expand Down Expand Up @@ -190,6 +192,7 @@ export async function createMarkdownFilesWatcher (ctx: Context) {
notifyStoryChange()
}
ctx.markdownFiles.splice(index, 1)
notifyMarkdownListChange()
}
}

Expand Down

0 comments on commit e85af38

Please sign in to comment.