Skip to content

Commit 7776f4b

Browse files
committed
Fix notification panel filtering and sorting
1 parent aa1a7f1 commit 7776f4b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/react-renderer-demo/src/app/src/components/notification-panel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const getNotifications = () => {
4040
const query = `?orderBy="expired-at"&startAt="${new Date().toISOString()}"&limitToFirst=10`;
4141
return fetch(`https://data-driven-forms.firebaseio.com/notifications.json${query}`)
4242
.then((data) => data.json())
43-
.then((data) => data || []);
43+
.then((data) => data.filter(Boolean).sort((a, b) => b['created-at'].localeCompare(a['created-at'])) || []);
4444
};
4545

4646
const createNotificationId = (notification) => `${notification['created-at']}-${notification['expired-at']}`;

0 commit comments

Comments
 (0)