Skip to content

Commit 3c59f26

Browse files
committed
fix(snippets): flickering lang selector via add new fragment
1 parent 6a503c5 commit 3c59f26

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/renderer/composable/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,10 @@ export const onCreateSnippet = async (body: Partial<Snippet>) => {
4141
track('api/snippet-create')
4242
}
4343

44-
export const onAddNewFragment = () => {
44+
export const onAddNewFragment = async () => {
4545
const snippetStore = useSnippetStore()
4646

47-
snippetStore.addNewFragmentToSnippetsById(snippetStore.selectedId!)
48-
snippetStore.fragment = snippetStore.fragmentCount!
49-
47+
await snippetStore.addNewFragmentToSnippetsById(snippetStore.selectedId!)
5048
track('snippets/add-fragment')
5149
}
5250

src/renderer/store/snippets.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,7 @@ export const useSnippetStore = defineStore('snippets', {
195195
body.content = content
196196

197197
await this.patchSnippetsById(id, body)
198-
await this.getSnippetsByFolderIds(folderStore.selectedIds!)
199-
await this.getSnippetsById(id)
198+
this.fragment = content.length - 1
200199
},
201200
async deleteCurrentSnippetFragmentByIndex (index: number) {
202201
const body: Partial<Snippet> = {}

0 commit comments

Comments
 (0)