feature/IO-3096-GlobalNotifications - Checkpoint - Clean up previous socket usages by funneling them all through useSocket vs useContext(SocketConext), package updates.

This commit is contained in:
Dave Richer
2025-02-27 11:56:31 -05:00
parent 17c4e2fd0e
commit 01b18a4a02
22 changed files with 409 additions and 386 deletions

View File

@@ -3,7 +3,7 @@ import { useQuery } from "@apollo/client";
import { connect } from "react-redux";
import NotificationCenterComponent from "./notification-center.component";
import { GET_NOTIFICATIONS } from "../../graphql/notifications.queries";
import { useSocket } from "../../contexts/SocketIO/socketContext.jsx";
import { INITIAL_NOTIFICATIONS, useSocket } from "../../contexts/SocketIO/socketContext.jsx";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors.js";
@@ -31,7 +31,7 @@ export function NotificationCenterContainer({ visible, onClose, bodyshop }) {
refetch
} = useQuery(GET_NOTIFICATIONS, {
variables: {
limit: 20,
limit: INITIAL_NOTIFICATIONS,
offset: 0,
where: whereClause
},
@@ -147,7 +147,9 @@ export function NotificationCenterContainer({ visible, onClose, bodyshop }) {
useEffect(() => {
if (visible && !isConnected) {
refetch();
refetch().catch(
(err) => `Something went wrong re-fetching notifications in the notification-center: ${err?.message || ""}`
);
}
}, [visible, isConnected, refetch]);