Skip to content

Commit 03c82ee

Browse files
committed
Fix(tags)
Again...
1 parent 6f892f7 commit 03c82ee

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "flyingtodo",
3-
"version": "1.3.1",
3+
"version": "1.3.2",
44
"description": "A TODO list application to learn JS, that I will maybe continue later.",
55
"main": "main.js",
66
"scripts": {

script/script.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ function refreshToDo() {
137137
containertags.innerHTML = '<button class="addtagbutton">+</button>';
138138

139139
const addtagbutton = divtodo.querySelector('.addtagbutton');
140-
140+
const currentTags = item.tagg || [] ;
141141

142142
addtagbutton.addEventListener('click', () => {
143143
if (isopen4 == false) {
@@ -149,7 +149,7 @@ function refreshToDo() {
149149
isopen4 = false;
150150
};
151151
});
152-
item.tagg.forEach(tag => {
152+
currentTags.forEach(tag => {
153153

154154

155155
let tagInTodo = document.createElement('p');
@@ -220,6 +220,9 @@ function refreshToDo() {
220220
tagInList.style.cursor = "pointer";
221221

222222
tagInList.addEventListener('click', () => {
223+
if (!item.tagg) {
224+
item.tagg = [];
225+
}
223226
if (!item.tagg.some(t => t.name === tag.name)) {
224227

225228
item.tagg.push(tag);

0 commit comments

Comments
 (0)