Incorrect issue position when creating an issue from issue board
Problem
When an issue is created, the relative_position
of the issue is moved to the end so that it appears at the bottom of any issue board list. This is done in the background by IssuePlacementWorker
and also Boards::Issues::ListService.initialize_relative_positions
if the issue is being loaded into a board list before the worker gets to run.
When a user creates an issue using the +
button on the issue list, the frontend displays the newly created issue at the top of the list. This makes sense so that the user can easily see the issue that they just created. But this is inconsistent with what's on the backend and refreshing the page would show the correct backend order where the issue is at the bottom.
There's also a problem with this newly created issue because the relative_position
is still nil
and could cause issues with dragging issues around this card like in #338667 (closed)
Screencast
board-issue-moves-to-bottom-after-creation
Proposed Solution
For the current GraphQL boards, I suggest we pass a param to the issue create mutation. We just need to pass in moveAfterId
which is the ID of the current issue that's on top of the list.
The issue creation mutation does not support this right now on the backend though, so we'd have to add that.