Refactor NGRX use in threat beta
Closed this issue · 0 comments
j987987 commented
UserCitationService
has atake(1)
pipe on the data it collects. I recommend replacingforkJoin
withcombineLatest
and removing thetake(1)
, so the service will update if the underlying data is updated- Various components use the
threatboardService.editArticle
andthreatboardService.updateBoard
functions the modifying the class properties in memory. This breaks the immutability convention in NGRX, and any component using subscribing to that data in NGRX won't be notified of updates - if they do get updates, it will be through the shared object reference in memory, but that break angular's strict change detection strategy. I recommend making an NGRX effect for these updates and dispatching the update - A lot of components subscribe to NGRX, assign the data to a class property, then also have their own loading logic. Assigning the NGRX selection to a class observable property and using the
| async
pipe in the template will prevent the need to use loading logic, and simplfying the component