diff --git a/src/features/questions/questions-list/QuestionsList.jsx b/src/features/questions/questions-list/QuestionsList.jsx index bc8d8d3..432d05d 100644 --- a/src/features/questions/questions-list/QuestionsList.jsx +++ b/src/features/questions/questions-list/QuestionsList.jsx @@ -38,6 +38,7 @@ const QuestionsList = () => { const isCompactMode = useSelector(selectIsCompactModeToogle); const questionsIds = useSelector(questionSelectors.selectIds); + const questionsAll = useSelector(questionSelectors.selectAll); const scrollHandler = useCallback( (e) => { @@ -67,8 +68,10 @@ const QuestionsList = () => { }, [deletedOnly, dispatch, favoritesOnly]); useEffect(() => { - dispatch(fetchQuestions({ favoritesOnly, deletedOnly })); - }, [deletedOnly, dispatch, favoritesOnly]); + if (!questionsAll.length) { + dispatch(fetchQuestions({ favoritesOnly, deletedOnly })); + } + }, [deletedOnly, dispatch, favoritesOnly, questionsAll.length]); const QuestionWrapper = isCompactMode ? Paper : React.Fragment; const generatedTitle = generateTitle(deletedOnly, favoritesOnly); diff --git a/src/features/questions/questionsSlice.js b/src/features/questions/questionsSlice.js index c06c824..97e6295 100644 --- a/src/features/questions/questionsSlice.js +++ b/src/features/questions/questionsSlice.js @@ -179,7 +179,7 @@ const questionsSlice = createSlice({ }, [resetQuestionsList]: (state) => { - questionsAdapter.removeAll(state); + // questionsAdapter.removeAll(state); state.pagination.offset = 0; state.pagination.totalQuestions = 0;