fix: remove attachment by id #725

Merged
konrad merged 1 commits from dpschen/frontend:feature/remove-attachment-by-id into main 2021-09-10 12:50:42 +00:00
Member
No description provided.
dpschen reviewed 2021-09-08 19:18:27 +00:00
@ -1,5 +1,10 @@
import Vue from 'vue'
// FIXME: put in global helper
Author
Member

I'm using this function later as a helper in the store.
Since it is not merged yet I created a local copy as a helper.

I'm using this function later as a helper in the store. Since it is not merged yet I created a local copy as a helper.

Sounds fine, could you remove this PR as wip until the other one got merged?

Sounds fine, could you remove this PR as wip until the other one got merged?
Author
Member

I would rather merge it already since the other one is the vue3 main branch (again keeping changes small).
But I guess I could already add the real helper. Will put on WIP until I added that.

I would rather merge it already since the other one is the vue3 main branch (again keeping changes small). But I guess I could already add the real helper. Will put on WIP until I added that.
Author
Member

I moved it in a helper file.

I moved it in a helper file.
dpschen marked this conversation as resolved
dpschen reviewed 2021-09-08 19:20:34 +00:00
@ -15,13 +20,9 @@ export default {
state.attachments.push(attachment)
},
removeById(state, id) {
for (const a in state.attachments) {
Author
Member

Some problem as we had already: looping via for...in doesn't result in consistant indices.

Some problem as we had already: looping via for...in doesn't result in consistant indices.
dpschen marked this conversation as resolved
dpschen changed title from fix: remove attachment by id to wip: fix: remove attachment by id 2021-09-08 22:15:47 +00:00
dpschen force-pushed feature/remove-attachment-by-id from 572993555f to b201729cdd 2021-09-08 22:56:44 +00:00 Compare
dpschen reviewed 2021-09-08 22:59:19 +00:00
@ -0,0 +1,3 @@
export function findIndexById(array : [], id : string | number) {
Author
Member

I'm not sure if an id can be of type number sometimes since it seemed to me that sometimes the index === id.
Since this is a helper function I guess the type could also be any

If this is fine as-is feel free to merge.

I'm not sure if an id can be of type number sometimes since it seemed to me that sometimes the `index === id`. Since this is a helper function I guess the type could also be `any` If this is fine as-is feel free to merge.
dpschen marked this conversation as resolved
dpschen changed title from wip: fix: remove attachment by id to fix: remove attachment by id 2021-09-08 23:00:58 +00:00
konrad merged commit 0376ef53e3 into main 2021-09-10 12:50:42 +00:00
konrad deleted branch feature/remove-attachment-by-id 2021-09-10 12:50:42 +00:00
This repo is archived. You cannot comment on pull requests.
No description provided.