unfetter-discover/unfetter

Refactor NGRX use in threat beta

Closed this issue · 0 comments

  • UserCitationService has a take(1) pipe on the data it collects. I recommend replacing forkJoin with combineLatest and removing the take(1), so the service will update if the underlying data is updated
  • Various components use the threatboardService.editArticle and threatboardService.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