awing-library 2.1.55-beta → 2.1.57-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/ACM-AXN/Notifications/NotificationDetail/NotificationList/NotificationItem/index.js
CHANGED
|
@@ -25,7 +25,7 @@ var NotificationItem = function (props) {
|
|
|
25
25
|
};
|
|
26
26
|
var handleClickNotification = function () {
|
|
27
27
|
navigate((0, Message_1.getFullDescription)(sagaTransactionType, t, fields).url);
|
|
28
|
-
status === Types_1.NotificationMessageStatus.
|
|
28
|
+
status === Types_1.NotificationMessageStatus.Unread &&
|
|
29
29
|
onUpdateStatus({ id: id, status: status });
|
|
30
30
|
};
|
|
31
31
|
var itemStatus = status === Types_1.NotificationMessageStatus.Unread;
|
|
@@ -44,7 +44,7 @@ var NotificationList = function (props) {
|
|
|
44
44
|
var _c = (0, react_1.useState)(notificationMessage), notifications = _c[0], setNotifications = _c[1];
|
|
45
45
|
(0, react_1.useLayoutEffect)(function () {
|
|
46
46
|
setNotifications(valueFilter.tabs === Constant_1.Constants.UNREAD
|
|
47
|
-
? notificationMessage.filter(function (item) { return item.status === Types_1.NotificationMessageStatus.
|
|
47
|
+
? notificationMessage.filter(function (item) { return item.status === Types_1.NotificationMessageStatus.Unread; })
|
|
48
48
|
: notificationMessage);
|
|
49
49
|
}, [notificationMessage, valueFilter.tabs]);
|
|
50
50
|
if (!notifications.length && !isLoading) {
|
|
@@ -72,6 +72,7 @@ var NotificationDetail = function (props) {
|
|
|
72
72
|
var _b = react_1.default.useState(false), isLoading = _b[0], setIsLoading = _b[1];
|
|
73
73
|
var _c = react_1.default.useState(-1), count = _c[0], setCount = _c[1];
|
|
74
74
|
var _d = (0, react_1.useState)([]), notificationMessage = _d[0], setNotificationMessage = _d[1];
|
|
75
|
+
var totalItemCount = (0, react_1.useRef)(0);
|
|
75
76
|
(0, react_1.useEffect)(function () {
|
|
76
77
|
var observer = new IntersectionObserver(handleIntersection);
|
|
77
78
|
var lastItem = document.getElementById('last-Item');
|
|
@@ -86,7 +87,9 @@ var NotificationDetail = function (props) {
|
|
|
86
87
|
};
|
|
87
88
|
}, []);
|
|
88
89
|
(0, react_1.useEffect)(function () {
|
|
89
|
-
if (count >= 0
|
|
90
|
+
if (count >= 0 &&
|
|
91
|
+
(totalItemCount.current > notificationMessage.length ||
|
|
92
|
+
notificationMessage.length === 0)) {
|
|
90
93
|
setIsLoading(true);
|
|
91
94
|
service
|
|
92
95
|
.notificationsPaging(count, Constant_1.Constants.PAGE_SIZE_DEFAULT, valueFilter.textSearch, valueFilter.status, [])
|
|
@@ -97,6 +100,7 @@ var NotificationDetail = function (props) {
|
|
|
97
100
|
});
|
|
98
101
|
return __spreadArray(__spreadArray([], prevMessages, true), newItems, true);
|
|
99
102
|
});
|
|
103
|
+
totalItemCount.current = res.totalItemCount;
|
|
100
104
|
})
|
|
101
105
|
.finally(function () {
|
|
102
106
|
setIsLoading(false);
|
|
@@ -113,6 +117,7 @@ var NotificationDetail = function (props) {
|
|
|
113
117
|
var handleValueFilter = function (textSearch, tabs) {
|
|
114
118
|
textSearch.length === 0 ? setCount(0) : setCount(-1);
|
|
115
119
|
setNotificationMessage([]);
|
|
120
|
+
totalItemCount.current = 0;
|
|
116
121
|
setValueFilter({
|
|
117
122
|
textSearch: textSearch,
|
|
118
123
|
tabs: tabs,
|