Commit 4b5e00a8 authored by Marcos Barrera's avatar Marcos Barrera Committed by Phil Hughes

Resolve "Error while updating todo status: the button is stuck in the loading state"

parent 7876a739
...@@ -79,10 +79,13 @@ export default class Todos { ...@@ -79,10 +79,13 @@ export default class Todos {
.then(({ data }) => { .then(({ data }) => {
this.updateRowState(target); this.updateRowState(target);
this.updateBadges(data); this.updateBadges(data);
}).catch(() => flash(__('Error updating todo status.'))); }).catch(() => {
this.updateRowState(target, true);
return flash(__('Error updating todo status.'));
});
} }
updateRowState(target) { updateRowState(target, isInactive = false) {
const row = target.closest('li'); const row = target.closest('li');
const restoreBtn = row.querySelector('.js-undo-todo'); const restoreBtn = row.querySelector('.js-undo-todo');
const doneBtn = row.querySelector('.js-done-todo'); const doneBtn = row.querySelector('.js-done-todo');
...@@ -91,7 +94,10 @@ export default class Todos { ...@@ -91,7 +94,10 @@ export default class Todos {
target.removeAttribute('disabled'); target.removeAttribute('disabled');
target.classList.remove('disabled'); target.classList.remove('disabled');
if (target === doneBtn) { if (isInactive === true) {
restoreBtn.classList.add('hidden');
doneBtn.classList.remove('hidden');
} else if (target === doneBtn) {
row.classList.add('done-reversible'); row.classList.add('done-reversible');
restoreBtn.classList.remove('hidden'); restoreBtn.classList.remove('hidden');
} else if (target === restoreBtn) { } else if (target === restoreBtn) {
......
---
title: Fix the state of the Done button when there is an error in the GitLab Todos
section
merge_request:
author: marcos8896
type: fixed
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment