Skip to content

Commit a8043af

Browse files
committed
fix(desk): not updating entries
1 parent dcf7080 commit a8043af

File tree

2 files changed

+35
-8
lines changed

2 files changed

+35
-8
lines changed

packages/desktop/modules/collection/pages/CList.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ async function submit() {
6161
Object.keys(payload.value).forEach((key) => {
6262
payload.value[key] = ''
6363
})
64+
65+
dialog.value = false
6466
}
6567
6668
// Delete collection
@@ -72,7 +74,7 @@ async function deleteItem(collectionId: string) {
7274
<div>
7375
<v-dialog v-model="dialog">
7476
<v-card color="b-secondary" width="500">
75-
<v-card-head>
77+
<v-card-head class="px-4">
7678
<v-card-title>
7779
{{ $t('addEntity', [$t('collection')]) }}
7880
</v-card-title>
@@ -99,7 +101,11 @@ async function deleteItem(collectionId: string) {
99101
/>
100102
</div>
101103

102-
<v-btn :disabled="!payload.name || !payload.path" class="w-full">
104+
<v-btn
105+
:disabled="!payload.name || !payload.path"
106+
class="w-full"
107+
type="submit"
108+
>
103109
{{ $t('create') }}
104110
</v-btn>
105111
</w-form>

packages/desktop/modules/entry/pages/EFolder.vue

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@ function updateSelection() {
171171
}
172172
173173
watch(selected, updateSelection)
174+
watch(
175+
() => props.path,
176+
() => {
177+
selected.value = []
178+
}
179+
)
174180
175181
onKeyStroke(['ArrowDown', 'ArrowUp'], (e) => {
176182
if (!entries.value.length) return
@@ -201,7 +207,12 @@ async function updateItem(item: DirectoryEntry) {
201207
202208
const index = editItem.value
203209
204-
if (!index) return
210+
if (index === undefined) return
211+
212+
if (newPath === item.path) {
213+
editItem.value = undefined
214+
return
215+
}
205216
206217
await store
207218
.update({
@@ -215,16 +226,28 @@ async function updateItem(item: DirectoryEntry) {
215226
.catch(() => {
216227
item.name = DirectoryEntry.basename(item.path)
217228
})
229+
230+
editItem.value = undefined
218231
}
219232
220233
watch(selected, () => (editItem.value = undefined))
221234
222235
// show
223236
224237
function show(item: DirectoryEntry) {
225-
if (editItem.value) return
238+
if (editItem.value !== undefined) return
239+
240+
return router.push(`/entries/${item.path}`)
241+
}
242+
243+
async function onEnter(item: DirectoryEntry) {
244+
const index = entries.value.indexOf(item)
245+
246+
const promise = editItem.value === index ? updateItem : show
247+
248+
await promise(item)
226249
227-
router.push(`/entries/${item.path}`)
250+
updateSelection()
228251
}
229252
</script>
230253

@@ -280,10 +303,9 @@ function show(item: DirectoryEntry) {
280303
tabindex="0"
281304
@dblclick="show(item)"
282305
@click="onSelect($event, index)"
283-
@keydown.enter="show(item)"
306+
@keyup.enter="onEnter(item)"
284307
@keydown.f2="editItem = index"
285308
@keydown.esc="updateSelection"
286-
@mousedown.prevent
287309
>
288310
<v-td class="pl-10 flex pr-7">
289311
<div class="w-4 mr-2">
@@ -297,7 +319,6 @@ function show(item: DirectoryEntry) {
297319
size="sm"
298320
class="w-full max-w-[70%]"
299321
autofocus
300-
@keypress.enter="updateItem(item)"
301322
/>
302323

303324
<div

0 commit comments

Comments
 (0)