Angular v10, NGRX v10
I am facing a perplexing issue with my Plan object and Task properties using Angular v10 and NGRX v10. Despite making updates to Task properties within my TaskService by deep cloning the Plan object and dispatching an Action to update the Store, I notice that the Task properties revert back to their original values when logging in the Reducer. This has left me puzzled for four days now.
The process begins with dragging a Task on a Gantt Chart triggering the
TaskService.updateTasks(tasksToUpdate)
method, which is supposed to handle any changes made during user interaction.
To troubleshoot, I created a simplified version of my updateTasks
method called updateTasksSimple
, but the problem persists. Here is the simplified method:
// Simplified updateTasks method
public updateTasksSimple(tasks: ITask[]): void {
// Code here
}
Further investigation revealed that even after logging the updated Tasks before dispatching from TaskService, the Redux store doesn't reflect these updated values when accessed by other components subscribed to the Store. This inconsistency has me baffled.
Any guidance or insights on this matter would be greatly appreciated.
Update:
Upon further examination, I noticed a peculiar behavior in my app with regards to updating Task properties. Despite successfully updating Task properties on the Gantt page and dispatching actions to the Store, the Task page does not display the updated values if navigated directly. However, if I reload the app, update the Tasks twice on the Gantt page, and then navigate to the Task page, it shows the correct values. It seems like the initial values received by the observable are outdated, leading to this discrepancy.
This strange behavior has left me scratching my head as to why the initial values received by the observable do not reflect the current state in the Store. Any suggestions or assistance on resolving this issue would be highly valued.