refactor: add successOr, sweep remaining inline unwraps (RD-17)
Eight sites hand-rolled `rd.tag === 'Success' ? rd.value : fallback`. Six take the new `successOr(rd, fallback)`, one takes the existing `successOf`, and one (`big-profile.store.ts`) uses the existing `map`, since it returns a RemoteData rather than an unwrapped value. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import { HeadingComponent } from '@shared/ui/heading/heading.component';
|
||||
import { ApplicationListComponent } from '@shared/ui/application-list/application-list.component';
|
||||
import { ApplicationLinkComponent } from '@shared/ui/application-link/application-link.component';
|
||||
import { ASYNC } from '@shared/ui/async/async.component';
|
||||
import { successOr } from '@shared/application/remote-data';
|
||||
import { AanvragenStore } from '@registratie/application/aanvragen.store';
|
||||
import { Aanvraag, AanvraagType } from '@registratie/domain/aanvraag';
|
||||
import {
|
||||
@@ -88,10 +89,9 @@ export class MijnAanvragenSection {
|
||||
|
||||
protected submittedRow = submittedRow;
|
||||
|
||||
protected aanvragen = computed<Aanvraag[]>(() => {
|
||||
const rd = this.store.aanvragen();
|
||||
return rd.tag === 'Success' ? sortForDashboard(rd.value) : [];
|
||||
});
|
||||
protected aanvragen = computed<Aanvraag[]>(() =>
|
||||
sortForDashboard(successOr(this.store.aanvragen(), [])),
|
||||
);
|
||||
protected concepten_ = computed(() => concepten(this.aanvragen()));
|
||||
protected ingediend_ = computed(() => ingediend(this.aanvragen()));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user