mirror of
https://gitlab.com/megazordpobeda/DataRush.git
synced 2026-05-23 23:47:10 +00:00
test
This commit is contained in:
@@ -42,21 +42,16 @@ const TaskSolution: React.FC<TaskSolutionProps> = ({
|
|||||||
|
|
||||||
const solutionHistory = solutionsQuery.data || [];
|
const solutionHistory = solutionsQuery.data || [];
|
||||||
|
|
||||||
const getLatestSolution = () => {
|
|
||||||
return solutionHistory.length > 0 ? solutionHistory[solutionHistory.length - 1] : null;
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (solutionHistory.length > 0 && !currentSolution) {
|
if (solutionHistory.length > 0 && !currentSolution) {
|
||||||
setCurrentSolution(getLatestSolution());
|
setCurrentSolution(solutionHistory[0]);
|
||||||
}
|
}
|
||||||
}, [solutionHistory, currentSolution]);
|
}, [solutionHistory, currentSolution]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const latestSolution = getLatestSolution();
|
if (solutionHistory.length > 0 && currentSolution &&
|
||||||
if (solutionHistory.length > 0 && currentSolution && latestSolution &&
|
solutionHistory[0].id !== currentSolution.id) {
|
||||||
latestSolution.id !== currentSolution.id) {
|
setCurrentSolution(solutionHistory[0]);
|
||||||
setCurrentSolution(latestSolution);
|
|
||||||
}
|
}
|
||||||
}, [solutionHistory, currentSolution]);
|
}, [solutionHistory, currentSolution]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user