Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does
Fixes mutation in timeline reducer(s) which are handling the action
RESET_TITLES
&UPDATE_TITLE
.Cause Bug
For this finding the cause of bug was easy as the error message exaclty indicated where mutation was as shown below:
For
RESET_TITLES
:For
UPDATE_TITLE
:The spread operator doesn’t work as expected with deeply nested objects because it copies the values of the top-level properties of weeks to new addresses/references, but the inner objects retain the same addresses/references.
Fix
Resolved by using lodash cloneDeep.
any code holding that reference sees the changes instantly.
making the changes not immediately available. Also, after resetting the timeline week titles, the saveTimeline
was called immediately, leading to an API call right away. During this time, Redux had not yet received the
new updates.
Note:
While testing this #6138 changes should be available😅 or else /timeline page may not work.
(KEEPPING IT IN DRAFT UNTIL THEN & ALSO MANY TEST ARE FAILING FOR THIS)
Screenshots
Before:
Before.mp4
After:
After.mp4