Browse Source

make some fix with redux for better performance

unknown 2 years ago
parent
commit
19e2f07190
56 changed files with 160 additions and 163 deletions
  1. 1 1
      .eslintcache
  2. 20 20
      build/asset-manifest.json
  3. 1 1
      build/index.html
  4. 3 0
      build/static/js/0.e99bf1e5.chunk.js
  5. 0 0
      build/static/js/0.e99bf1e5.chunk.js.LICENSE.txt
  6. 1 0
      build/static/js/0.e99bf1e5.chunk.js.map
  7. 0 3
      build/static/js/0.ea4551fb.chunk.js
  8. 0 1
      build/static/js/0.ea4551fb.chunk.js.map
  9. 3 0
      build/static/js/5.1a886b73.chunk.js
  10. 0 0
      build/static/js/5.1a886b73.chunk.js.LICENSE.txt
  11. 1 1
      build/static/js/5.1a90b71b.chunk.js.map
  12. 0 3
      build/static/js/5.1a90b71b.chunk.js
  13. 3 3
      build/static/js/6.6b4232f4.chunk.js
  14. 0 0
      build/static/js/6.50810af4.chunk.js.LICENSE.txt
  15. 1 1
      build/static/js/6.6b4232f4.chunk.js.map
  16. 2 2
      build/static/js/AuthPage.c5e50f23.chunk.js
  17. 1 1
      build/static/js/AuthPage.c5e50f23.chunk.js.map
  18. 0 2
      build/static/js/HomePage.0720b43f.chunk.js
  19. 0 1
      build/static/js/HomePage.0720b43f.chunk.js.map
  20. 2 0
      build/static/js/HomePage.64718e77.chunk.js
  21. 1 0
      build/static/js/HomePage.64718e77.chunk.js.map
  22. 0 2
      build/static/js/main.b2e3f4d2.chunk.js
  23. 0 1
      build/static/js/main.b2e3f4d2.chunk.js.map
  24. 2 0
      build/static/js/main.b34fa139.chunk.js
  25. 1 0
      build/static/js/main.b34fa139.chunk.js.map
  26. 2 2
      build/static/js/runtime-main.d1b93a2f.js
  27. 1 1
      build/static/js/runtime-main.d1b93a2f.js.map
  28. 30 0
      package-lock.json
  29. 2 0
      package.json
  30. 1 2
      src/App.tsx
  31. 4 3
      src/components/HomePage/LeftBar/ChatsList/index.tsx
  32. 1 1
      src/components/HomePage/LeftBar/ContactsList/index.tsx
  33. 2 2
      src/components/HomePage/LeftBar/EditBar/index.tsx
  34. 1 2
      src/components/HomePage/LeftBar/SearchLists/index.tsx
  35. 2 2
      src/components/HomePage/LeftBar/SettingsBar/SettingsPicture/index.tsx
  36. 0 1
      src/components/HomePage/LeftBar/SmallMenuBar/index.tsx
  37. 3 3
      src/components/HomePage/LeftBar/index.tsx
  38. 2 1
      src/components/HomePage/RightBar/RightListsAndBars/EditBar/Delete/index.tsx
  39. 3 1
      src/components/HomePage/RightBar/RightListsAndBars/EditBar/EditList/index.tsx
  40. 2 13
      src/components/HomePage/RightBar/RightListsAndBars/EditBar/index.tsx
  41. 22 0
      src/components/reusableComponents/Load/index.jsx
  42. 0 0
      src/components/reusableComponents/Load/index.module.css
  43. 0 38
      src/components/reusableComponents/Loader/Loader.jsx
  44. 1 1
      src/index.tsx
  45. 5 3
      src/redux/allMessages/reducer/index.ts
  46. 8 6
      src/redux/authorization/reducer/index.ts
  47. 2 2
      src/redux/authorization/selector/index.ts
  48. 8 5
      src/redux/chat/reducer/index.ts
  49. 5 3
      src/redux/chats/reducer/index.ts
  50. 5 3
      src/redux/contacts/reducer/index.ts
  51. 0 7
      src/redux/loading/action/index.ts
  52. 0 8
      src/redux/loading/reducer/index.ts
  53. 0 4
      src/redux/loading/selector/index.ts
  54. 5 3
      src/redux/messages/reducer/index.ts
  55. 0 2
      src/redux/rootReducer/index.ts
  56. 0 1
      src/typescript/redux/interfaces.ts

File diff suppressed because it is too large
+ 1 - 1
.eslintcache


+ 20 - 20
build/asset-manifest.json

@@ -1,36 +1,36 @@
 {
   "files": {
-    "static/js/0.ea4551fb.chunk.js": "/static/js/0.ea4551fb.chunk.js",
-    "static/js/0.ea4551fb.chunk.js.map": "/static/js/0.ea4551fb.chunk.js.map",
-    "AuthPage.js": "/static/js/AuthPage.c5e50f23.chunk.js",
-    "AuthPage.js.map": "/static/js/AuthPage.c5e50f23.chunk.js.map",
-    "HomePage.js": "/static/js/HomePage.0720b43f.chunk.js",
-    "HomePage.js.map": "/static/js/HomePage.0720b43f.chunk.js.map",
+    "static/js/0.e99bf1e5.chunk.js": "/static/js/0.e99bf1e5.chunk.js",
+    "static/js/0.e99bf1e5.chunk.js.map": "/static/js/0.e99bf1e5.chunk.js.map",
+    "AuthPage.js": "/static/js/AuthPage.75753e35.chunk.js",
+    "AuthPage.js.map": "/static/js/AuthPage.75753e35.chunk.js.map",
+    "HomePage.js": "/static/js/HomePage.64718e77.chunk.js",
+    "HomePage.js.map": "/static/js/HomePage.64718e77.chunk.js.map",
     "main.css": "/static/css/main.9a5b6280.chunk.css",
-    "main.js": "/static/js/main.b2e3f4d2.chunk.js",
-    "main.js.map": "/static/js/main.b2e3f4d2.chunk.js.map",
-    "runtime-main.js": "/static/js/runtime-main.d1b93a2f.js",
-    "runtime-main.js.map": "/static/js/runtime-main.d1b93a2f.js.map",
-    "static/js/5.1a90b71b.chunk.js": "/static/js/5.1a90b71b.chunk.js",
-    "static/js/5.1a90b71b.chunk.js.map": "/static/js/5.1a90b71b.chunk.js.map",
+    "main.js": "/static/js/main.b34fa139.chunk.js",
+    "main.js.map": "/static/js/main.b34fa139.chunk.js.map",
+    "runtime-main.js": "/static/js/runtime-main.439d1abb.js",
+    "runtime-main.js.map": "/static/js/runtime-main.439d1abb.js.map",
+    "static/js/5.1a886b73.chunk.js": "/static/js/5.1a886b73.chunk.js",
+    "static/js/5.1a886b73.chunk.js.map": "/static/js/5.1a886b73.chunk.js.map",
     "static/css/6.c7cc29b3.chunk.css": "/static/css/6.c7cc29b3.chunk.css",
-    "static/js/6.6b4232f4.chunk.js": "/static/js/6.6b4232f4.chunk.js",
-    "static/js/6.6b4232f4.chunk.js.map": "/static/js/6.6b4232f4.chunk.js.map",
+    "static/js/6.50810af4.chunk.js": "/static/js/6.50810af4.chunk.js",
+    "static/js/6.50810af4.chunk.js.map": "/static/js/6.50810af4.chunk.js.map",
     "index.html": "/index.html",
     "static/css/6.c7cc29b3.chunk.css.map": "/static/css/6.c7cc29b3.chunk.css.map",
     "static/css/main.9a5b6280.chunk.css.map": "/static/css/main.9a5b6280.chunk.css.map",
-    "static/js/0.ea4551fb.chunk.js.LICENSE.txt": "/static/js/0.ea4551fb.chunk.js.LICENSE.txt",
-    "static/js/5.1a90b71b.chunk.js.LICENSE.txt": "/static/js/5.1a90b71b.chunk.js.LICENSE.txt",
-    "static/js/6.6b4232f4.chunk.js.LICENSE.txt": "/static/js/6.6b4232f4.chunk.js.LICENSE.txt",
+    "static/js/0.e99bf1e5.chunk.js.LICENSE.txt": "/static/js/0.e99bf1e5.chunk.js.LICENSE.txt",
+    "static/js/5.1a886b73.chunk.js.LICENSE.txt": "/static/js/5.1a886b73.chunk.js.LICENSE.txt",
+    "static/js/6.50810af4.chunk.js.LICENSE.txt": "/static/js/6.50810af4.chunk.js.LICENSE.txt",
     "static/media/icons8-telegram-app.be023370.svg": "/static/media/icons8-telegram-app.be023370.svg",
     "static/media/monkey.ded8ac2a.png": "/static/media/monkey.ded8ac2a.png",
     "static/media/qrCode_telegram.bb0caf3c.png": "/static/media/qrCode_telegram.bb0caf3c.png"
   },
   "entrypoints": [
-    "static/js/runtime-main.d1b93a2f.js",
+    "static/js/runtime-main.439d1abb.js",
     "static/css/6.c7cc29b3.chunk.css",
-    "static/js/6.6b4232f4.chunk.js",
+    "static/js/6.50810af4.chunk.js",
     "static/css/main.9a5b6280.chunk.css",
-    "static/js/main.b2e3f4d2.chunk.js"
+    "static/js/main.b34fa139.chunk.js"
   ]
 }

File diff suppressed because it is too large
+ 1 - 1
build/index.html


File diff suppressed because it is too large
+ 3 - 0
build/static/js/0.e99bf1e5.chunk.js


build/static/js/0.ea4551fb.chunk.js.LICENSE.txt → build/static/js/0.e99bf1e5.chunk.js.LICENSE.txt


File diff suppressed because it is too large
+ 1 - 0
build/static/js/0.e99bf1e5.chunk.js.map


File diff suppressed because it is too large
+ 0 - 3
build/static/js/0.ea4551fb.chunk.js


File diff suppressed because it is too large
+ 0 - 1
build/static/js/0.ea4551fb.chunk.js.map


File diff suppressed because it is too large
+ 3 - 0
build/static/js/5.1a886b73.chunk.js


build/static/js/5.1a90b71b.chunk.js.LICENSE.txt → build/static/js/5.1a886b73.chunk.js.LICENSE.txt


File diff suppressed because it is too large
+ 1 - 1
build/static/js/5.1a90b71b.chunk.js.map


File diff suppressed because it is too large
+ 0 - 3
build/static/js/5.1a90b71b.chunk.js


File diff suppressed because it is too large
+ 3 - 3
build/static/js/6.6b4232f4.chunk.js


build/static/js/6.6b4232f4.chunk.js.LICENSE.txt → build/static/js/6.50810af4.chunk.js.LICENSE.txt


File diff suppressed because it is too large
+ 1 - 1
build/static/js/6.6b4232f4.chunk.js.map


File diff suppressed because it is too large
+ 2 - 2
build/static/js/AuthPage.c5e50f23.chunk.js


File diff suppressed because it is too large
+ 1 - 1
build/static/js/AuthPage.c5e50f23.chunk.js.map


File diff suppressed because it is too large
+ 0 - 2
build/static/js/HomePage.0720b43f.chunk.js


File diff suppressed because it is too large
+ 0 - 1
build/static/js/HomePage.0720b43f.chunk.js.map


File diff suppressed because it is too large
+ 2 - 0
build/static/js/HomePage.64718e77.chunk.js


File diff suppressed because it is too large
+ 1 - 0
build/static/js/HomePage.64718e77.chunk.js.map


File diff suppressed because it is too large
+ 0 - 2
build/static/js/main.b2e3f4d2.chunk.js


File diff suppressed because it is too large
+ 0 - 1
build/static/js/main.b2e3f4d2.chunk.js.map


File diff suppressed because it is too large
+ 2 - 0
build/static/js/main.b34fa139.chunk.js


File diff suppressed because it is too large
+ 1 - 0
build/static/js/main.b34fa139.chunk.js.map


File diff suppressed because it is too large
+ 2 - 2
build/static/js/runtime-main.d1b93a2f.js


File diff suppressed because it is too large
+ 1 - 1
build/static/js/runtime-main.d1b93a2f.js.map


+ 30 - 0
package-lock.json

@@ -33,6 +33,7 @@
         "formik": "^2.2.6",
         "gh-pages": "^3.1.0",
         "lodash.debounce": "^4.0.8",
+        "lodash.isequal": "^4.5.0",
         "modern-normalize": "^1.0.0",
         "react": "^17.0.1",
         "react-audio-player": "^0.17.0",
@@ -62,6 +63,7 @@
       },
       "devDependencies": {
         "@types/file-saver": "^2.0.5",
+        "@types/lodash.isequal": "^4.5.6",
         "@types/react-copy-to-clipboard": "^5.0.2",
         "@types/react-redux": "^7.1.18",
         "@types/react-router-dom": "^5.1.8",
@@ -3356,6 +3358,15 @@
       "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.165.tgz",
       "integrity": "sha512-tjSSOTHhI5mCHTy/OOXYIhi2Wt1qcbHmuXD1Ha7q70CgI/I71afO4XtLb/cVexki1oVYchpul/TOuu3Arcdxrg=="
     },
+    "node_modules/@types/lodash.isequal": {
+      "version": "4.5.6",
+      "resolved": "https://registry.npmjs.org/@types/lodash.isequal/-/lodash.isequal-4.5.6.tgz",
+      "integrity": "sha512-Ww4UGSe3DmtvLLJm2F16hDwEQSv7U0Rr8SujLUA2wHI2D2dm8kPu6Et+/y303LfjTIwSBKXB/YTUcAKpem/XEg==",
+      "dev": true,
+      "dependencies": {
+        "@types/lodash": "*"
+      }
+    },
     "node_modules/@types/minimatch": {
       "version": "3.0.3",
       "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz",
@@ -13898,6 +13909,11 @@
       "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz",
       "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U="
     },
+    "node_modules/lodash.isequal": {
+      "version": "4.5.0",
+      "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz",
+      "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA="
+    },
     "node_modules/lodash.isplainobject": {
       "version": "3.2.0",
       "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-3.2.0.tgz",
@@ -26431,6 +26447,15 @@
       "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.165.tgz",
       "integrity": "sha512-tjSSOTHhI5mCHTy/OOXYIhi2Wt1qcbHmuXD1Ha7q70CgI/I71afO4XtLb/cVexki1oVYchpul/TOuu3Arcdxrg=="
     },
+    "@types/lodash.isequal": {
+      "version": "4.5.6",
+      "resolved": "https://registry.npmjs.org/@types/lodash.isequal/-/lodash.isequal-4.5.6.tgz",
+      "integrity": "sha512-Ww4UGSe3DmtvLLJm2F16hDwEQSv7U0Rr8SujLUA2wHI2D2dm8kPu6Et+/y303LfjTIwSBKXB/YTUcAKpem/XEg==",
+      "dev": true,
+      "requires": {
+        "@types/lodash": "*"
+      }
+    },
     "@types/minimatch": {
       "version": "3.0.3",
       "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz",
@@ -35123,6 +35148,11 @@
       "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz",
       "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U="
     },
+    "lodash.isequal": {
+      "version": "4.5.0",
+      "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz",
+      "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA="
+    },
     "lodash.isplainobject": {
       "version": "3.2.0",
       "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-3.2.0.tgz",

+ 2 - 0
package.json

@@ -28,6 +28,7 @@
     "formik": "^2.2.6",
     "gh-pages": "^3.1.0",
     "lodash.debounce": "^4.0.8",
+    "lodash.isequal": "^4.5.0",
     "modern-normalize": "^1.0.0",
     "react": "^17.0.1",
     "react-audio-player": "^0.17.0",
@@ -83,6 +84,7 @@
   },
   "devDependencies": {
     "@types/file-saver": "^2.0.5",
+    "@types/lodash.isequal": "^4.5.6",
     "@types/react-copy-to-clipboard": "^5.0.2",
     "@types/react-redux": "^7.1.18",
     "@types/react-router-dom": "^5.1.8",

+ 1 - 2
src/App.tsx

@@ -12,7 +12,7 @@ import { asyncLogout, asyncCurrentUser } from './redux/authorization/operations'
 import { setToken, onlineUser,typingChat } from './api-data'
 import PrivateRoute from './components/reusableComponents/Routes/PrivateRoute';
 import PublicRoute from './components/reusableComponents/Routes/PublicRoute';
-import { Load,CLoad } from './components/reusableComponents/Loader/Loader';
+import Load from './components/reusableComponents/Load';
 
 const HomePage = lazy(
   () =>
@@ -76,7 +76,6 @@ function App() {
               </PublicRoute>
           </Switch>
         </BrowserRouter>
-        <CLoad/>
       </Suspense>
       <ToastContainer
       position="top-right"

+ 4 - 3
src/components/HomePage/LeftBar/ChatsList/index.tsx

@@ -51,7 +51,8 @@ const ChatsList = ({sort}:IChatsList) => {
   const chatsRef = useRef<any>(null)
   const { total, chats } = useSelector(getStateMemo)
   const chat = useSelector(getChatMemo)
-  const { leftIsOpen,rightIsOpen} = useSelector(getState)
+  const { leftIsOpen, rightIsOpen } = useSelector(getState)
+  
   const handleListItemClick = (companionId: string) => {
     rightIsOpen&&dispatch(actionRightIsOpen(''))
     dispatch(asyncStartChatById(companionId))
@@ -64,7 +65,7 @@ const ChatsList = ({sort}:IChatsList) => {
     dispatch(asyncStartChatById(companionId))
   }
 
-  const handleNotification= useCallback((companionId: string) => {
+  const handleNotification = useCallback((companionId: string) => {
     dispatch(asyncStartChatById(companionId))
     dispatch(actionScrollChat(true))
   }, [dispatch])
@@ -91,7 +92,7 @@ const ChatsList = ({sort}:IChatsList) => {
         if(chat === undefined) return
         const newDifferent = chat.total - chat.seen
         if (newDifferent > oldDifferent && !chat.mute) {
-          playNotificationWithoutPermission(`${prodBaseURL}/receive.mp3`)
+          playNotificationWithoutPermission(`${prodBaseURL}/telegramReceive.mp3`)
           notification(chat.name,() => handleNotification(chat.companionId))
         } 
       })

+ 1 - 1
src/components/HomePage/LeftBar/ContactsList/index.tsx

@@ -9,7 +9,7 @@ import { getState } from '../../../../redux/contacts/selector'
 import { asyncGetContacts } from '../../../../redux/contacts/operations';
 import { asyncStartChatById } from '../../../../redux/chat/operations'
 import * as controlSelector from '../../../../redux/control/selector'
-import { actionLeftIsOpen,actionRightIsOpen } from '../../../../redux/control/action';
+import { actionLeftIsOpen, actionRightIsOpen } from '../../../../redux/control/action';
 import { handleSort,timeStampFilter,refreshAppTime } from '../../../../helpers';
 import { TContacts,TContact } from '../../../../typescript/redux/contacts/types';
 

+ 2 - 2
src/components/HomePage/LeftBar/EditBar/index.tsx

@@ -4,7 +4,7 @@ import { useSelector,useDispatch } from 'react-redux';
 import ToolBar from './ToolBar'
 import EditList from './EditList'
 import SubmitBtn from './SubmitBtn';
-import { getState } from '../../../../redux/authorization/selector'
+import { getAuthorizationState } from '../../../../redux/authorization/selector'
 import { asyncCurrentUser } from '../../../../redux/authorization/operations';
 import { updateCredentials, updateUserAvatar } from '../../../../api-data';
 import { refreshAppTime } from '../../../../helpers';
@@ -25,7 +25,7 @@ interface IEditBar {
 const EditBar= ({setSelectedIndex}:IEditBar) => {
   const classes = useStyles()
   const dispatch = useDispatch()
-  const user = useSelector(getState)
+  const user = useSelector(getAuthorizationState)
   const [name, setName] = useState<string>('')
   const [lastName, setLastName] = useState<string>('')
   const [openBtn, setOpenBtn] = useState<boolean>(false)

+ 1 - 2
src/components/HomePage/LeftBar/SearchLists/index.tsx

@@ -18,7 +18,6 @@ import { asyncStartChatById } from '../../../../redux/chat/operations';
 import { actionLeftIsOpen,actionRightIsOpen } from '../../../../redux/control/action';
 import { TChats } from '../../../../typescript/redux/chats/types';
 
-
 const useStyles = makeStyles({
 container: {
   height:'7vh',
@@ -63,7 +62,7 @@ interface ISearchLists {
 const SearchLists = ({ value,setValue,sort,date,setDate,setDisabled }: ISearchLists) => {
     const classes = useStyles()
     const dispatch = useDispatch()
-    const { chats,total } = useSelector(getStateMemo)
+    const { chats, total } = useSelector(getStateMemo)
     const messagesMemo = useSelector(getAllMessagesMemo)
     const {leftIsOpen,rightIsOpen} = useSelector(getState)
     const [isActive, setIsActive] = useState<number>(0)

+ 2 - 2
src/components/HomePage/LeftBar/SettingsBar/SettingsPicture/index.tsx

@@ -1,7 +1,7 @@
 import { makeStyles } from '@material-ui/core'
 import { useSelector } from 'react-redux';
 import { useState } from 'react';
-import { getState } from '../../../../../redux/authorization/selector'
+import { getAuthorizationState } from '../../../../../redux/authorization/selector'
 import { Carousel } from 'react-responsive-carousel';
 import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline';
 import Avatar from '@mui/material/Avatar';
@@ -71,7 +71,7 @@ const useStyles = makeStyles({
 
 const SettingsPicture = () => {
   const classes = useStyles()
-  const { name, lastName, avatarsArr, online } = useSelector(getState)
+  const { name, lastName, avatarsArr, online } = useSelector(getAuthorizationState)
   const [modal, setModal] = useState<boolean>(false);
   const [index, setIndex] = useState<number>(0);
   const handleClick = (): void => setModal(true)

+ 0 - 1
src/components/HomePage/LeftBar/SmallMenuBar/index.tsx

@@ -4,7 +4,6 @@ import { styled } from '@mui/material/styles';
 import Avatar from '@mui/material/Avatar';
 import Menu from '@mui/material/Menu';
 import MenuItem from '@mui/material/MenuItem';
-import ChatIcon from '@mui/icons-material/Chat';
 import PermContactCalendarIcon from '@mui/icons-material/PermContactCalendar';
 import ModeEditOutlineOutlinedIcon from '@mui/icons-material/ModeEditOutlineOutlined';
 import CloseIcon from '@mui/icons-material/Close';

+ 3 - 3
src/components/HomePage/LeftBar/index.tsx

@@ -12,12 +12,12 @@ import ContactsList from './ContactsList'
 import AddContact from './AddContact'
 import SettingsBar from './SettingsBar';
 import EditBar from './EditBar';
-import { getState } from '../../../redux/authorization/selector';
+import { getAuthorizationState } from '../../../redux/authorization/selector';
 import { actionLeftIsOpen } from '../../../redux/control/action';
 
 const LeftBar = () => {
   const dispatch = useDispatch()
-  const { sort,nightMode } = useSelector(getState)
+  const { sort,nightMode } = useSelector(getAuthorizationState)
   const [isSearch, setIsSearch] = useState<boolean>(false)
   const [isMenu, setIsMenu] = useState<boolean>(false)
   const [isMenuSm, setIsMenuSm] = useState<boolean>(false);
@@ -31,10 +31,10 @@ const LeftBar = () => {
     dispatch(actionLeftIsOpen(''))
     setValue('')
     setDate('')
+    setDisabled(false)
     if (selectedIndex) setSelectedIndex(null)
     if(!isSearch) return setIsMenu(!isMenu)
     setIsSearch(false)
-    setDisabled(false)
   }
   const handleSearch = (e: React.ChangeEvent<HTMLInputElement>):void => setValue(e.target.value)
   const handleEnterOpenMenuSm = (): void => {

+ 2 - 1
src/components/HomePage/RightBar/RightListsAndBars/EditBar/Delete/index.tsx

@@ -50,7 +50,8 @@ const Delete = ({ isContact }:{ isContact:TContact}) => {
   const classes = useStyles()
   const dispatch = useDispatch()
   const {_id,avatarUrl,color,name,lastName} = isContact
-  const [modal,setModal] = useState<boolean>(false)
+  const [modal, setModal] = useState<boolean>(false)
+  
   const handleDeleteModal = (e: any) => {
     const id = e.target.id
     if (id === 'overlay' || id === 'cancel') return setModal(false)

+ 3 - 1
src/components/HomePage/RightBar/RightListsAndBars/EditBar/EditList/index.tsx

@@ -56,11 +56,13 @@ interface IEditList {
 const EditList = (props: IEditList) => {
   const classes = useStyles()
   const {chat,name,setName,lastName,setLastName,mute,setMute,openBtn,setOpenBtn} = props
-  const { avatarUrl,color,originalName,originalLastName } = chat
+  const { avatarUrl, color, originalName, originalLastName } = chat
+  
   const handleNotifications = () => {
     setMute(!mute)
     !openBtn&&setOpenBtn(true)
   }
+  
   const handleTextField = (e: React.ChangeEvent<HTMLInputElement>) => {
   !openBtn&&setOpenBtn(true)
   const value = format(e.target.value)

+ 2 - 13
src/components/HomePage/RightBar/RightListsAndBars/EditBar/index.tsx

@@ -1,16 +1,14 @@
 import { makeStyles } from '@material-ui/core'
 import { useState,useEffect } from 'react';
-import { useSelector,useDispatch } from 'react-redux';
+import { useSelector } from 'react-redux';
 import ToolBar from './ToolBar'
 import EditList from './EditList'
 import Delete from './Delete'
 import SubmitBtn from './SubmitBtn';
 import { getContactsMemo } from '../../../../../redux/contacts/selector'
-import { getState } from '../../../../../redux/control/selector'
-import { asyncGetContacts } from '../../../../../redux/contacts/operations'
 import { getChat } from '../../../../../redux/chat/selector'
 import { muteChat, updateContact } from '../../../../../api-data';
-import { refreshAppTime } from '../../../../../helpers';
+
 
 const useStyles = makeStyles({
   editBar: {
@@ -22,8 +20,6 @@ const useStyles = makeStyles({
 
 const EditBar= () => {
   const classes = useStyles()
-  const dispatch = useDispatch()
-  const { leftIsOpen } = useSelector(getState)
   const contactsMemo = useSelector(getContactsMemo)
   const chat = useSelector(getChat)
   const [isContact, setIsContact] = useState<any>(false)
@@ -43,13 +39,6 @@ const EditBar= () => {
     openBtn&&setOpenBtn(false)
   }
 
-  useEffect(() => {
-    const handleReset = () => leftIsOpen !== 'contacts'&&dispatch(asyncGetContacts())
-    handleReset()
-    const idInterval = setInterval(handleReset, refreshAppTime);
-    return () => clearInterval(idInterval);
-  }, [leftIsOpen, dispatch]);  
-
   useEffect(() => {
     const contact = contactsMemo.find((el) => el.number === chat.number)
     contact && setIsContact(contact)    

+ 22 - 0
src/components/reusableComponents/Load/index.jsx

@@ -0,0 +1,22 @@
+import 'react-loader-spinner/dist/loader/css/react-spinner-loader.css';
+import Loader from 'react-loader-spinner';
+
+import s from './index.module.css';
+
+const Load = () => {
+  return (
+    <Loader
+      className={s.loader}
+      type="Puff"
+      color="#0ca0f5"
+      height={100}
+      width={100}
+      timeout={300000}
+    />
+  )
+};
+
+export default Load
+
+
+

src/components/reusableComponents/Loader/Loader.module.css → src/components/reusableComponents/Load/index.module.css


+ 0 - 38
src/components/reusableComponents/Loader/Loader.jsx

@@ -1,38 +0,0 @@
-import 'react-loader-spinner/dist/loader/css/react-spinner-loader.css';
-import Loader from 'react-loader-spinner';
-import { useSelector } from 'react-redux';
-
-import {getLoad} from '../../../redux/loading/selector'
-import s from './Loader.module.css';
-
-const CLoad = () => {
-  const isLoading = useSelector(getLoad)
-  return isLoading?(
-    <Loader
-      className={s.loader}
-      type="Puff"
-      color="#0ca0f5"
-      height={100}
-      width={100}
-      timeout={300000}
-    />
-  ):null
-};
-
-const Load = () => {
-  return (
-    <Loader
-      className={s.loader}
-      type="Puff"
-      color="#0ca0f5"
-      height={100}
-      width={100}
-      timeout={300000}
-    />
-  )
-};
-
-export {CLoad,Load};
-
-
-

+ 1 - 1
src/index.tsx

@@ -8,7 +8,7 @@ import 'modern-normalize/modern-normalize.css';
 import "react-responsive-carousel/lib/styles/carousel.min.css"
 import './index.css';
 import App from './App';
-import { Load } from './components/reusableComponents/Loader/Loader'
+import  Load  from './components/reusableComponents/Load'
 import { store, persistor } from './redux/store';
 import { QueryClient, QueryClientProvider } from 'react-query';
 

+ 5 - 3
src/redux/allMessages/reducer/index.ts

@@ -1,3 +1,4 @@
+import isEqual from 'lodash.isequal';
 import { createReducer } from '@reduxjs/toolkit';
 import { IAllMessagesState, IAllMessagesPayload} from '../../../typescript/redux/allMessages/interfaces';
 import {
@@ -13,10 +14,11 @@ const initialState: IAllMessagesState = {
 }
 
 const reducerAllMessages = createReducer(initialState, {
-  [actionGetAllMessagesSuccess.type]: (_, { payload }: IAllMessagesPayload) => {
-    return payload;
+  [actionGetAllMessagesSuccess.type]: (state, { payload }: IAllMessagesPayload) => {
+    if (isEqual(state, payload) === false) return payload
+    return state;
   },
-  [actionGetAllMessagesReject.type]: (state, _) => {
+  [actionGetAllMessagesReject.type]: (state, _payload) => {
     return state;
   },
 });

+ 8 - 6
src/redux/authorization/reducer/index.ts

@@ -1,3 +1,4 @@
+import isEqual from 'lodash.isequal';
 import { createReducer } from '@reduxjs/toolkit';
 import { IAuthorizationState , IAuthorizationPayload} from '../../../typescript/redux/authorization/interfaces';
 import {
@@ -34,19 +35,20 @@ const reducerAuthorization = createReducer(initialState, {
   [actionLogInSuccess.type]: (state, { payload:token }: { payload: string }) => {
     return {...state,token};
   },
-  [actionLogInReject.type]: (state, _) => {
+  [actionLogInReject.type]: (state, _payload) => {
     return state;
   },
-  [actionLogOutSuccess.type]: (_state, _) => {
+  [actionLogOutSuccess.type]: (_state, _payload) => {
     return initialState;
   },
-  [actionLogOutReject.type]: (state, _) => {
+  [actionLogOutReject.type]: (state, _payload) => {
     return state;
   },
-  [actionCurrentSuccess.type]: (_state, { payload }:IAuthorizationPayload) => {
-    return payload
+  [actionCurrentSuccess.type]: (state, { payload }: IAuthorizationPayload) => {
+    if (isEqual(state, payload) === false) return payload
+    return state;
   },
-  [actionCurrentReject.type]: (_state, _) => {
+  [actionCurrentReject.type]: (_state, _payload) => {
     return initialState;
   },
 });

+ 2 - 2
src/redux/authorization/selector/index.ts

@@ -8,6 +8,6 @@ const getCountry = (state: IState) => state.authorization.country;
 const getAvatarUrl = (state: IState) => state.authorization.avatarUrl;
 const getId = (state: IState) => state.authorization._id;
 const getSort= (state:IState) => state.authorization.sort;
-const getState= (state:IState) => state.authorization;
+const getAuthorizationState= (state:IState) => state.authorization;
 
-export { getToken,getNumber,getName,getLastName,getCountry,getAvatarUrl,getId,getSort,getState };
+export { getToken,getNumber,getName,getLastName,getCountry,getAvatarUrl,getId,getSort,getAuthorizationState };

+ 8 - 5
src/redux/chat/reducer/index.ts

@@ -1,3 +1,4 @@
+import isEqual from 'lodash.isequal';
 import { createReducer } from '@reduxjs/toolkit';
 import { IChatPayload } from '../../../typescript/redux/chat/interfaces';
 import { TChat} from '../../../typescript/redux/chat/types';
@@ -35,13 +36,15 @@ const initialState: TChat = {
 }
 
 const reducerChat = createReducer(initialState, {
-  [actionSelectChat.type]: (_,{ payload }:IChatPayload) => {
-    return payload
+  [actionSelectChat.type]: (state, { payload }: IChatPayload) => {
+    if (isEqual(state, payload) === false) return payload
+    return state;
   },
-  [actionGetChatById.type]: (_,{ payload }:IChatPayload) => {
-    return payload
+  [actionGetChatById.type]: (state, { payload }: IChatPayload) => {
+    if (isEqual(state, payload) === false) return payload
+    return state;
   },
-  [actionRemoveChat.type]: (_state,_) => {
+  [actionRemoveChat.type]: (_state,_payload) => {
     return initialState
   },    
 });

+ 5 - 3
src/redux/chats/reducer/index.ts

@@ -1,3 +1,4 @@
+import isEqual from 'lodash.isequal';
 import { createReducer } from '@reduxjs/toolkit';
 import { IChatsState, IChatsPayload } from '../../../typescript/redux/chats/interfaces';
 
@@ -16,10 +17,11 @@ const initialState: IChatsState = {
 
 
 const reducerChats = createReducer(initialState, {
-  [actionGetChatsSuccess.type]: (_,{ payload }:IChatsPayload) => {
-    return payload
+  [actionGetChatsSuccess.type]: (state, { payload }: IChatsPayload) => {
+    if (isEqual(state, payload) === false) return payload
+    return state;
   },
-  [actionGetChatsReject.type]: (state, _) => {
+  [actionGetChatsReject.type]: (state, _payload) => {
     return state;
   },
 });

+ 5 - 3
src/redux/contacts/reducer/index.ts

@@ -1,3 +1,4 @@
+import isEqual from 'lodash.isequal';
 import { createReducer } from '@reduxjs/toolkit';
 import { IContactsState,IContactsPayload} from '../../../typescript/redux/contacts/interfaces';
 import {
@@ -13,10 +14,11 @@ const initialState:IContactsState = {
 }
 
 const reducerContacts = createReducer(initialState, {
-  [actionGetContactsSuccess.type]: (_state,{ payload}:IContactsPayload) => {
-    return payload;
+  [actionGetContactsSuccess.type]: (state, { payload }: IContactsPayload) => {
+    if (isEqual(state, payload) === false) return payload
+    return state;
   },
-  [actionGetContactsReject.type]: (state, _) => {
+  [actionGetContactsReject.type]: (state, _payload) => {
     return state;
   },
 });

+ 0 - 7
src/redux/loading/action/index.ts

@@ -1,7 +0,0 @@
-import { createAction } from '@reduxjs/toolkit';
-
-const actionIsLoading = createAction('fetch/loading', (value:boolean) => ({
-  payload: value,
-}));
-
-export { actionIsLoading };

+ 0 - 8
src/redux/loading/reducer/index.ts

@@ -1,8 +0,0 @@
-import { createReducer } from '@reduxjs/toolkit';
-import { actionIsLoading } from '../action';
-
-const reducerLoading = createReducer(false, {
-  [actionIsLoading.type]: (_, { payload }: {payload : boolean}) => payload,
-});
-
-export default reducerLoading;

+ 0 - 4
src/redux/loading/selector/index.ts

@@ -1,4 +0,0 @@
-import { IState } from '../../../typescript/redux/interfaces'
-const getLoad = (state:IState) => state.isLoading;
-
-export { getLoad };

+ 5 - 3
src/redux/messages/reducer/index.ts

@@ -1,3 +1,4 @@
+import isEqual from 'lodash.isequal';
 import { createReducer } from '@reduxjs/toolkit';
 import { IMessagesState, IMessagesPayload} from '../../../typescript/redux/messages/interfaces';
 import {
@@ -13,10 +14,11 @@ const initialState: IMessagesState = {
 }
 
 const reducerMessages = createReducer(initialState, {
-  [actionGetMessagesSuccess.type]: (_, { payload }: IMessagesPayload) => {
-    return payload;
+  [actionGetMessagesSuccess.type]: (state, { payload }: IMessagesPayload) => {
+    if (isEqual(state, payload) === false) return payload
+    return state;
   },
-  [actionGetMessagesReject.type]: (state, _) => {
+  [actionGetMessagesReject.type]: (state, _payload_) => {
     return state;
   },
 });

+ 0 - 2
src/redux/rootReducer/index.ts

@@ -8,7 +8,6 @@ import reducerContacts from '../contacts/reducer'
 import reducerChat from '../chat/reducer'
 import reducerChats from '../chats/reducer'
 import reducerControl from '../control/reducer'
-import reducerLoading from '../loading/reducer';
 import reducerAuthorization from '../authorization/reducer';
 
 const authorizationPersistConfig = {
@@ -17,7 +16,6 @@ const authorizationPersistConfig = {
 };
 
 export const rootReducer = combineReducers({
-  isLoading: reducerLoading,
   messages: reducerMessages,
   allMessages: reducerAllMessages,
   chat:reducerChat,

+ 0 - 1
src/typescript/redux/interfaces.ts

@@ -13,6 +13,5 @@ export interface IState {
   chat:TChat,
   chats: IChatsState,
   control:IControlState,
-  isLoading: boolean;
   authorization: IAuthorizationState
 }