Checkbox / tasklist performance and possible data loss...
See original issue https://gitlab.com/gitlab-org/gitlab-ce/issues/19745 for addition details and history.
User A and user B are viewing the same MR/issue, that has many many checkbox items. Both need to check off different items at the same time. However, since each one is checking a different item and sending the entire description to the server, they end up overwriting each others checks. Also, performance in checking each box is very slow as the entire markdown description must be re-rendered and displayed.
SOURCEPOS option in the CommonMark parser, we can get line number information in the generated html, which ties back to the source markdown. This should allow us, when clicking a checkbox, to pull the exact source line from the markdown we have cached in the frontend. We then send that line and the line number to a new endpoint in the backend.
The backend should be able to pull the source from the DB, double check that the source at the requested line number matches what we sent down (for sanity), then update that single line in the source and the cached html, and save it out.
We wouldn't want to use the
lock_version in this case - the description can change in a variety of ways - as long as the exact text still exists on the specific line, we can save the checkbox.
However, since RedCarpet doesn't support source lines, then we would want to fallback to using the
lock_version and the full description in that case.
No rendering on the backend is required or checking of references, since we are only toggling a checkbox. The UI could then simply toggle the checkbox.