Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
stephmilovic committed Aug 4, 2023
1 parent 313a098 commit 66d3cfe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const REQUEST_NAMES = {
ENABLE_RISK_SCORE: `${APP_UI_ID} fetch enable risk score`,
REFRESH_RISK_SCORE: `${APP_UI_ID} fetch refresh risk score`,
UPGRADE_RISK_SCORE: `${APP_UI_ID} fetch upgrade risk score`,
GET_DATA_VIEW: `${APP_UI_ID} get data view`,
} as const;

export type RequestName = typeof REQUEST_NAMES[keyof typeof REQUEST_NAMES];
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { getOr } from 'lodash/fp';
import memoizeOne from 'memoize-one';
import { useCallback, useState, useEffect, useRef } from 'react';
import { useCallback, useState, useEffect } from 'react';
import { useDispatch } from 'react-redux';

import { getTimelineQueryTypes } from '../helpers';
Expand Down Expand Up @@ -111,12 +111,7 @@ export const useGetAllTimeline = (): AllTimelinesArgs => {
templateTimelineCount: 0,
favoriteCount: 0,
});
const isMounted = useRef(true);
useEffect(() => {
return () => {
isMounted.current = false;
};
}, []);

const fetchAllTimeline = useCallback(
async ({
onlyUserFavorite,
Expand Down Expand Up @@ -154,7 +149,7 @@ export const useGetAllTimeline = (): AllTimelinesArgs => {
getAllTimelineResponse?.elasticTemplateTimelineCount ?? 0;
const templateTimelineCount = getAllTimelineResponse?.templateTimelineCount ?? 0;
const favoriteCount = getAllTimelineResponse?.favoriteCount ?? 0;
if (!didCancel && isMounted.current) {
if (!didCancel) {
dispatch(
inputsActions.setQuery({
inputId: InputsModelId.global,
Expand All @@ -176,7 +171,7 @@ export const useGetAllTimeline = (): AllTimelinesArgs => {
});
}
} catch (error) {
if (!didCancel && isMounted.current) {
if (!didCancel) {
errorToToaster({
title: i18n.ERROR_FETCHING_TIMELINES_TITLE,
error: error.body && error.body.message ? new Error(error.body.message) : error,
Expand Down

0 comments on commit 66d3cfe

Please sign in to comment.