diff --git a/src/components/main/Notifications/index.tsx b/src/components/main/Notifications/index.tsx index 30fa2abf..34b1f415 100644 --- a/src/components/main/Notifications/index.tsx +++ b/src/components/main/Notifications/index.tsx @@ -56,9 +56,9 @@ const NotificationsUnconnected: FC = ({ const hideList = useCallback(() => setVisible(false), [setVisible]); useEffect(() => { - if (!visible || !has_new) return; - authSetLastSeenMessages(new Date().toISOString()); - }, [visible]); + if (!visible || !has_new || !last) return; + authSetLastSeenMessages(last); + }, [visible, last]); return (
= yield call( reqWrapper, apiAuthGetUpdates, - { exclude_dialogs, last } + { exclude_dialogs, last: last || user.last_seen_messages } ); if (error || !data || !data.notifications || !data.notifications.length) return; @@ -246,16 +246,14 @@ function* getUpdates() { function* startPollingSaga() { while (true) { yield call(getUpdates); - yield delay(60000); + yield delay(10000); } } function* setLastSeenMessages({ last_seen_messages }: ReturnType) { if (!Date.parse(last_seen_messages)) return; - const { data, error } = yield call(reqWrapper, apiUpdateUser, { user: { last_seen_messages } }); - - console.log({ data, error }); + yield call(reqWrapper, apiUpdateUser, { user: { last_seen_messages } }); } function* authSaga() { diff --git a/src/redux/node/sagas.ts b/src/redux/node/sagas.ts index 91f65661..1ac51712 100644 --- a/src/redux/node/sagas.ts +++ b/src/redux/node/sagas.ts @@ -92,10 +92,12 @@ function* onNodeSave({ node }: ReturnType) { function* onNodeGoto({ id, node_type }: ReturnType) { if (node_type) yield put(nodeSetCurrent({ ...EMPTY_NODE, type: node_type })); + yield put(nodeLoadNode(id)); - yield put(push(URLS.NODE_URL(id))); yield put(nodeSetCommentData(0, { ...EMPTY_COMMENT })); yield put(nodeSetRelated(null)); + + yield put(push(URLS.NODE_URL(id))); } function* onNodeLoad({ id, order = 'ASC' }: ReturnType) {