Skip to content

Commit f6109ee

Browse files
authored
[ENG-9633] Optimize registration initial load (#737)
- Ticket: [ENG-9633] ## Purpose Optimize initial page load time of the registration overview page ## Summary of Changes 1. Removed embeds. 2. Split code into smaller components. 3. Update states.
1 parent 438954d commit f6109ee

File tree

126 files changed

+2908
-1856
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+2908
-1856
lines changed

src/app/app.routes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ export const routes: Routes = [
6868
path: 'my-projects',
6969
loadComponent: () =>
7070
import('./features/my-projects/my-projects.component').then((mod) => mod.MyProjectsComponent),
71-
providers: [provideStates([BookmarksState, ProjectsState])],
7271
canActivate: [authGuard],
72+
providers: [provideStates([BookmarksState, ProjectsState])],
7373
},
7474
{
7575
path: 'my-registrations',

src/app/core/components/nav-menu/nav-menu.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { NO_ERRORS_SCHEMA, signal } from '@angular/core';
44
import { ComponentFixture, TestBed } from '@angular/core/testing';
55
import { ActivatedRoute, Router } from '@angular/router';
66

7+
import { CustomMenuItem } from '@core/models/custom-menu-item.model';
78
import { AuthService } from '@core/services/auth.service';
8-
import { CustomMenuItem } from '@osf/core/models';
99
import { ProviderSelectors } from '@osf/core/store/provider/provider.selectors';
1010
import { UserSelectors } from '@osf/core/store/user/user.selectors';
1111
import { IconComponent } from '@osf/shared/components/icon/icon.component';

src/app/features/analytics/components/view-duplicates/view-duplicates.component.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
88
import { ActivatedRoute, Router } from '@angular/router';
99

1010
import { ProjectOverviewSelectors } from '@osf/features/project/overview/store';
11-
import { RegistryOverviewSelectors } from '@osf/features/registry/store/registry-overview';
11+
import { RegistrySelectors } from '@osf/features/registry/store/registry';
1212
import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component';
1313
import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component';
1414
import { IconComponent } from '@osf/shared/components/icon/icon.component';
@@ -64,8 +64,8 @@ describe('Component: View Duplicates', () => {
6464
{ selector: DuplicatesSelectors.getDuplicatesTotalCount, value: 0 },
6565
{ selector: ProjectOverviewSelectors.getProject, value: MOCK_PROJECT_OVERVIEW },
6666
{ selector: ProjectOverviewSelectors.isProjectAnonymous, value: false },
67-
{ selector: RegistryOverviewSelectors.getRegistry, value: undefined },
68-
{ selector: RegistryOverviewSelectors.isRegistryAnonymous, value: false },
67+
{ selector: RegistrySelectors.getRegistry, value: undefined },
68+
{ selector: RegistrySelectors.isRegistryAnonymous, value: false },
6969
],
7070
}),
7171
MockProvider(CustomDialogService, mockCustomDialogService),

src/app/features/analytics/components/view-duplicates/view-duplicates.component.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ import { ActivatedRoute, Router, RouterLink } from '@angular/router';
2525
import { UserSelectors } from '@core/store/user';
2626
import { DeleteComponentDialogComponent, ForkDialogComponent } from '@osf/features/project/overview/components';
2727
import { ClearProjectOverview, GetProjectById, ProjectOverviewSelectors } from '@osf/features/project/overview/store';
28-
import {
29-
ClearRegistryOverview,
30-
GetRegistryById,
31-
RegistryOverviewSelectors,
32-
} from '@osf/features/registry/store/registry-overview';
28+
import { ClearRegistry, GetRegistryById, RegistrySelectors } from '@osf/features/registry/store/registry';
3329
import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component';
3430
import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component';
3531
import { IconComponent } from '@osf/shared/components/icon/icon.component';
@@ -72,9 +68,9 @@ export class ViewDuplicatesComponent {
7268
private router = inject(Router);
7369
private destroyRef = inject(DestroyRef);
7470
private project = select(ProjectOverviewSelectors.getProject);
75-
private registration = select(RegistryOverviewSelectors.getRegistry);
71+
private registration = select(RegistrySelectors.getRegistry);
7672
private isProjectAnonymous = select(ProjectOverviewSelectors.isProjectAnonymous);
77-
private isRegistryAnonymous = select(RegistryOverviewSelectors.isRegistryAnonymous);
73+
private isRegistryAnonymous = select(RegistrySelectors.isRegistryAnonymous);
7874

7975
duplicates = select(DuplicatesSelectors.getDuplicates);
8076
isDuplicatesLoading = select(DuplicatesSelectors.getDuplicatesLoading);
@@ -127,7 +123,7 @@ export class ViewDuplicatesComponent {
127123
getDuplicates: GetAllDuplicates,
128124
clearDuplicates: ClearDuplicates,
129125
clearProject: ClearProjectOverview,
130-
clearRegistration: ClearRegistryOverview,
126+
clearRegistration: ClearRegistry,
131127
getComponentsTree: GetResourceWithChildren,
132128
});
133129

src/app/features/analytics/components/view-linked-projects/view-linked-projects.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
66
import { ActivatedRoute } from '@angular/router';
77

88
import { ProjectOverviewSelectors } from '@osf/features/project/overview/store';
9-
import { RegistryOverviewSelectors } from '@osf/features/registry/store/registry-overview';
9+
import { RegistrySelectors } from '@osf/features/registry/store/registry';
1010
import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component';
1111
import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component';
1212
import { IconComponent } from '@osf/shared/components/icon/icon.component';
@@ -54,7 +54,7 @@ describe('Component: View Duplicates', () => {
5454
{ selector: LinkedProjectsSelectors.getLinkedProjectsLoading, value: false },
5555
{ selector: LinkedProjectsSelectors.getLinkedProjectsTotalCount, value: 0 },
5656
{ selector: ProjectOverviewSelectors.getProject, value: MOCK_PROJECT_OVERVIEW },
57-
{ selector: RegistryOverviewSelectors.getRegistry, value: undefined },
57+
{ selector: RegistrySelectors.getRegistry, value: undefined },
5858
],
5959
}),
6060
MockProvider(ActivatedRoute, activatedRouteMock),

src/app/features/analytics/components/view-linked-projects/view-linked-projects.component.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,7 @@ import { toSignal } from '@angular/core/rxjs-interop';
2222
import { ActivatedRoute, RouterLink } from '@angular/router';
2323

2424
import { ClearProjectOverview, GetProjectById, ProjectOverviewSelectors } from '@osf/features/project/overview/store';
25-
import {
26-
ClearRegistryOverview,
27-
GetRegistryById,
28-
RegistryOverviewSelectors,
29-
} from '@osf/features/registry/store/registry-overview';
25+
import { ClearRegistry, GetRegistryById, RegistrySelectors } from '@osf/features/registry/store/registry';
3026
import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component';
3127
import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component';
3228
import { IconComponent } from '@osf/shared/components/icon/icon.component';
@@ -59,7 +55,7 @@ export class ViewLinkedProjectsComponent {
5955
private route = inject(ActivatedRoute);
6056
private destroyRef = inject(DestroyRef);
6157
private project = select(ProjectOverviewSelectors.getProject);
62-
private registration = select(RegistryOverviewSelectors.getRegistry);
58+
private registration = select(RegistrySelectors.getRegistry);
6359

6460
linkedProjects = select(LinkedProjectsSelectors.getLinkedProjects);
6561
isLoading = select(LinkedProjectsSelectors.getLinkedProjectsLoading);
@@ -93,7 +89,7 @@ export class ViewLinkedProjectsComponent {
9389
getLinkedProjects: GetAllLinkedProjects,
9490
clearLinkedProjects: ClearLinkedProjects,
9591
clearProject: ClearProjectOverview,
96-
clearRegistration: ClearRegistryOverview,
92+
clearRegistration: ClearRegistry,
9793
});
9894

9995
constructor() {

src/app/features/metadata/components/metadata-affiliated-institutions/metadata-affiliated-institutions.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<p-card>
22
<div class="flex justify-content-between align-items-center">
3-
<h2>{{ 'project.overview.metadata.affiliatedInstitutions' | translate }}</h2>
3+
<h2>{{ 'common.labels.affiliatedInstitutions' | translate }}</h2>
44

55
@if (!readonly()) {
66
<p-button
@@ -13,6 +13,6 @@ <h2>{{ 'project.overview.metadata.affiliatedInstitutions' | translate }}</h2>
1313
</div>
1414

1515
<div class="mt-4">
16-
<osf-affiliated-institutions-view [institutions]="affiliatedInstitutions()" [showTitle]="false" />
16+
<osf-affiliated-institutions-view [institutions]="affiliatedInstitutions()" />
1717
</div>
1818
</p-card>

src/app/features/my-projects/mappers/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/app/features/my-projects/my-projects.component.ts

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,13 @@ import { SearchInputComponent } from '@osf/shared/components/search-input/search
2828
import { SelectComponent } from '@osf/shared/components/select/select.component';
2929
import { SubHeaderComponent } from '@osf/shared/components/sub-header/sub-header.component';
3030
import { DEFAULT_TABLE_PARAMS } from '@osf/shared/constants/default-table-params.constants';
31-
import { ResourceType } from '@osf/shared/enums/resource-type.enum';
3231
import { SortOrder } from '@osf/shared/enums/sort-order.enum';
3332
import { IS_MEDIUM } from '@osf/shared/helpers/breakpoints.tokens';
3433
import { CustomDialogService } from '@osf/shared/services/custom-dialog.service';
3534
import { ProjectRedirectDialogService } from '@osf/shared/services/project-redirect-dialog.service';
36-
import { BookmarksSelectors, GetBookmarksCollectionId } from '@osf/shared/stores/bookmarks';
35+
import { BookmarksSelectors, GetAllMyBookmarks, GetBookmarksCollectionId } from '@osf/shared/stores/bookmarks';
3736
import {
3837
ClearMyResources,
39-
GetMyBookmarks,
4038
GetMyPreprints,
4139
GetMyProjects,
4240
GetMyRegistrations,
@@ -82,7 +80,6 @@ export class MyProjectsComponent implements OnInit {
8280
readonly queryService = inject(MyProjectsQueryService);
8381
readonly tableParamsService = inject(MyProjectsTableParamsService);
8482

85-
readonly bookmarksPageSize = 100;
8683
readonly isLoading = signal(false);
8784
readonly isMedium = toSignal(inject(IS_MEDIUM));
8885
readonly tabOptions = MY_PROJECTS_TABS;
@@ -104,12 +101,13 @@ export class MyProjectsComponent implements OnInit {
104101
readonly projects = select(MyResourcesSelectors.getProjects);
105102
readonly registrations = select(MyResourcesSelectors.getRegistrations);
106103
readonly preprints = select(MyResourcesSelectors.getPreprints);
107-
readonly bookmarks = select(MyResourcesSelectors.getBookmarks);
108104
readonly totalProjectsCount = select(MyResourcesSelectors.getTotalProjects);
109105
readonly totalRegistrationsCount = select(MyResourcesSelectors.getTotalRegistrations);
110106
readonly totalPreprintsCount = select(MyResourcesSelectors.getTotalPreprints);
111-
readonly totalBookmarksCount = select(MyResourcesSelectors.getTotalBookmarks);
107+
108+
readonly bookmarks = select(BookmarksSelectors.getBookmarks);
112109
readonly bookmarksCollectionId = select(BookmarksSelectors.getBookmarksCollectionId);
110+
readonly totalBookmarksCount = select(BookmarksSelectors.getBookmarksTotalCount);
113111
readonly isBookmarks = computed(() => this.selectedTab() === MyProjectsTab.Bookmarks);
114112

115113
readonly actions = createDispatchMap({
@@ -118,7 +116,7 @@ export class MyProjectsComponent implements OnInit {
118116
getMyProjects: GetMyProjects,
119117
getMyRegistrations: GetMyRegistrations,
120118
getMyPreprints: GetMyPreprints,
121-
getMyBookmarks: GetMyBookmarks,
119+
getMyBookmarks: GetAllMyBookmarks,
122120
});
123121

124122
constructor() {
@@ -314,13 +312,7 @@ export class MyProjectsComponent implements OnInit {
314312
break;
315313
case MyProjectsTab.Bookmarks:
316314
if (this.bookmarksCollectionId()) {
317-
action$ = this.actions.getMyBookmarks(
318-
this.bookmarksCollectionId(),
319-
pageNumber,
320-
this.bookmarksPageSize,
321-
filters,
322-
ResourceType.Null
323-
);
315+
action$ = this.actions.getMyBookmarks(this.bookmarksCollectionId(), filters);
324316
}
325317
break;
326318
}

src/app/features/preprints/components/preprint-details/additional-info/additional-info.component.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ export class AdditionalInfoComponent {
4343
if (!preprint) return null;
4444
return preprint.embeddedLicense;
4545
});
46-
licenseOptionsRecord = computed(() => {
47-
return (this.preprint()?.licenseOptions ?? {}) as Record<string, string>;
48-
});
46+
47+
licenseOptionsRecord = computed(() => (this.preprint()?.licenseOptions ?? {}) as Record<string, string>);
4948

5049
skeletonData = Array.from({ length: 5 }, () => null);
5150

0 commit comments

Comments
 (0)