-
Notifications
You must be signed in to change notification settings - Fork 188
support deleting board #73
base: master
Are you sure you want to change the base?
Conversation
It makes sense to delete all board related data: columns, tasks, comments (it's possible to make the deletions cascade in case of FK relationships)
Yup, need
Absolutely, but this can be a follow up and an extra confirmation alert (as we have for comment deletions) should be enough at first :) |
Hi @rrebase Thanks for your suggestions.
I am sorry I didn't express myself clearly. I noticed the
As I don't have much experience in React/Redux, is there a method which is similar to BTW, If a column or task is deleted, the related comment would not be deleted in frontend while the related tasks would be deleted once a column is deleted. Do we need to create another issue/PR to handle it? Could you kindly review it again? |
Yea, it makes sense to clean up the store (even though not strictly necessary as the data isn't persisted).
With the simple redux-toolkit setup, there's no cascade feature that would avoid the explicit deletion form each slice afaik.
Good catch, feel free to create an issue/PR to resolve this :) |
const indexOfDeletedBoard = state.all.findIndex((obj) => { | ||
if (obj.id == action.payload) { | ||
return true; | ||
} | ||
return false; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can keep this short
const indexOfDeletedBoard = state.all.findIndex((obj) => { | |
if (obj.id == action.payload) { | |
return true; | |
} | |
return false; | |
}); | |
const indexOfDeletedBoard = state.all.findIndex(board => board.id === action.payload); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @rrebase
The type of board.id
is number while the type of action.payload
and return value of deleteBoard
is string.
So a new commit make all of them above be restricted to be string
like fetchUserById typing-createasyncthunk does.
const { id } = useParams();
is used which makes the type of id
is any
. Actually, it passes a string
type to Id
/number
type. That's why dispatch(deleteBoard(id));
works before.
Let me know if you have any concern.
eb50466
to
7a39987
Compare
Fix #52
I just implement a small feature with simple UI, deleting a board, I hope you don't mind.
Could you kindly review it?
Question: Currently, column stats are deleted once a board is deleted. I am not sure whether task, comment, member and label states should be deleted as well. Do you have any suggestions?
If they are expected to be deleted, besides adding the following snippet in each single slice function, is there other ways?
Deleting a board is a dangerous operation, so it's better to
close board
first and then delete closed board like deleting-a-board in trello.But it will introduce more effort to implement more feature as follow,
close board