diff --git a/app/assets/javascripts/actions/revisions_actions.js b/app/assets/javascripts/actions/revisions_actions.js index 7cc9d4af07..918c1bf3ab 100644 --- a/app/assets/javascripts/actions/revisions_actions.js +++ b/app/assets/javascripts/actions/revisions_actions.js @@ -1,4 +1,3 @@ - import { RECEIVE_REVISIONS, REVISIONS_LOADING, @@ -35,12 +34,19 @@ const fetchAllArticles = async (course) => { const fetchRevisionsPromise = async (course, users, last_date, dispatch) => { const { revisions, last_date: new_last_date } = await fetchRevisionsFromUsers(course, users, 7, last_date); - course.revisions = sortRevisionsByDate(revisions); - // we don't await this. When the assessments/references get laoded, the action is dispatched + // Create a new course object with updated revisions + const updatedCourse = { + ...course, + revisions: sortRevisionsByDate(revisions), + }; + + // we don't await this. When the assessments/references get loaded, the action is dispatched fetchRevisionsAndReferences(revisions, dispatch); - return { course, last_date: new_last_date }; + + return { course: updatedCourse, last_date: new_last_date }; }; + const fetchRevisionsCourseSpecificPromise = async (course, users, last_date, dispatch, articles) => { const trackedArticles = new Set( articles.filter(article => article.tracked).map(article => article.title)