Skip to content

Commit

Permalink
fix(snippets): flickering lang selector via add new fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
antonreshetov committed May 6, 2022
1 parent 6a503c5 commit 3c59f26
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/renderer/composable/index.ts
Expand Up @@ -41,12 +41,10 @@ export const onCreateSnippet = async (body: Partial<Snippet>) => {
track('api/snippet-create')
}

export const onAddNewFragment = () => {
export const onAddNewFragment = async () => {
const snippetStore = useSnippetStore()

snippetStore.addNewFragmentToSnippetsById(snippetStore.selectedId!)
snippetStore.fragment = snippetStore.fragmentCount!

await snippetStore.addNewFragmentToSnippetsById(snippetStore.selectedId!)
track('snippets/add-fragment')
}

Expand Down
3 changes: 1 addition & 2 deletions src/renderer/store/snippets.ts
Expand Up @@ -195,8 +195,7 @@ export const useSnippetStore = defineStore('snippets', {
body.content = content

await this.patchSnippetsById(id, body)
await this.getSnippetsByFolderIds(folderStore.selectedIds!)
await this.getSnippetsById(id)
this.fragment = content.length - 1
},
async deleteCurrentSnippetFragmentByIndex (index: number) {
const body: Partial<Snippet> = {}
Expand Down

0 comments on commit 3c59f26

Please sign in to comment.