Browse Source

small fix

sheva77 3 năm trước cách đây
mục cha
commit
60c9d7c5c2

+ 6 - 2
chat_final_bootstrap/src/Reducers/index.js

@@ -234,7 +234,11 @@ function msgReducer(state = {}, action) {
         // обновить счетчик
         countMsgInChat(action.msg.chat._id);
 
-        return { ...state, ...{ [action.msg.chat._id]: [...state[action.msg.chat._id], newMsgItem] } };
+        if (state[action.msg.chat._id]) {
+            return { ...state, ...{ [action.msg.chat._id]: [...state[action.msg.chat._id], newMsgItem] } };
+        }
+
+        return { ...state, ...{ [action.msg.chat._id]: newMsgItem } };
     }
 
     return state;
@@ -319,4 +323,4 @@ export const store = createStore(
     applyMiddleware(thunk)
 );
 
-// store.subscribe(() => console.log(store.getState()));
+store.subscribe(() => console.log(store.getState()));

+ 9 - 0
temp2 - дерево вариантов.js

@@ -1,3 +1,5 @@
+//
+
 let testArr = [
     ["USA", "Mexico"],
     ["Green", "Red", "Blue"],
@@ -92,3 +94,10 @@ let testArr = [
     } while ((indexes = inc(indexes)));
     return result;
 })();
+
+for (let el of notes) {
+    let d = document.createelement("div");
+    body.append(d);
+    d.append(el.text);
+    d.classList.add("uk-table");
+}