Skip to content

Commit 447884c

Browse files
atarix83Andrea Barbasso
authored andcommitted
Merged in task/main-cris/DSC-2099 (pull request DSpace#2654)
[DSC-2099] Fix problem with change detection Approved-by: Andrea Barbasso
2 parents 634d63f + fd44d74 commit 447884c

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

src/app/my-dspace-page/my-dspace-page.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
<ds-my-dspace-new-submission *dsShowOnlyForRole="[roleTypeEnum.Submitter]"></ds-my-dspace-new-submission>
55
</div>
66

7-
<ds-search *ngIf="configuration && context"
8-
[configuration]="configuration"
7+
<ds-search *ngIf="configuration() && context()"
8+
[configuration]="configuration()"
99
[configurationList]="(configurationList$ | async)"
10-
[context]="context"
10+
[context]="context()"
1111
[viewModeList]="viewModeList"
1212
[projection]="projection"
1313
[showThumbnails]="false">

src/app/my-dspace-page/my-dspace-page.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ describe('MyDSpacePageComponent', () => {
134134
);
135135

136136
flush();
137-
expect(comp.configuration).toBe(MyDSpaceConfigurationValueType.Workspace);
138-
expect(comp.context).toBe(Context.Workspace);
137+
expect(comp.configuration()).toBe(MyDSpaceConfigurationValueType.Workspace);
138+
expect(comp.context()).toBe(Context.Workspace);
139139
}));
140140
});

src/app/my-dspace-page/my-dspace-page.component.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
Component,
88
Inject,
99
OnInit,
10+
signal,
1011
} from '@angular/core';
1112
import { Observable } from 'rxjs';
1213
import { take } from 'rxjs/operators';
@@ -65,12 +66,12 @@ export class MyDSpacePageComponent implements OnInit {
6566
/**
6667
* The start context to use in the search: workspace or workflow
6768
*/
68-
context: Context;
69+
context = signal<Context>(null);
6970

7071
/**
7172
* The start configuration to use in the search: workspace or workflow
7273
*/
73-
configuration: string;
74+
configuration = signal<string>(null);
7475

7576
/**
7677
* Variable for enumeration RoleType
@@ -108,8 +109,8 @@ export class MyDSpacePageComponent implements OnInit {
108109
this.configurationList$ = this.searchConfigService.getAvailableConfigurationOptions();
109110

110111
this.configurationList$.pipe(take(1)).subscribe((configurationList: SearchConfigurationOption[]) => {
111-
this.configuration = configurationList[0].value;
112-
this.context = configurationList[0].context;
112+
this.configuration.set(configurationList[0].value);
113+
this.context.set(configurationList[0].context);
113114
});
114115

115116
}

0 commit comments

Comments
 (0)