Skip to content

Conversation

@dogi
Copy link
Member

@dogi dogi commented Jan 22, 2026

  • Created PlanetLoadingSpinnerComponent for page-level loading.
  • Refactored DialogsLoadingService to use reference counting and added wrap utility.
  • Created LoadingState utility with load operator.
  • Standardized loading patterns in Dashboard, Courses, Resources, and Community components.
  • Added documentation in src/app/shared/loading-patterns.md.
  • Ensured isLoading is correctly reset using finalize or error handling in observables.

https://jules.google.com/session/11740011107361944408

google-labs-jules bot and others added 4 commits January 22, 2026 20:23
- Created `PlanetLoadingSpinnerComponent` for page-level loading.
- Refactored `DialogsLoadingService` to use reference counting and added `wrap` utility.
- Created `LoadingState` utility with `load` operator.
- Standardized loading patterns in Dashboard, Courses, Resources, and Community components.
- Added documentation in `src/app/shared/loading-patterns.md`.
- Ensured `isLoading` is correctly reset using `finalize` or error handling in observables.
@Mutugiii
Copy link
Member

Mutugiii commented Jan 26, 2026

Refactored the PR to standardize the loader patterns and their usage in specific situations

The planet-loading-spinner now solidifies the inline loading that has been in place across tabs, for instance, while loading the voices

image

Note: A new translation round is needed to reflect the new loading texts

@Mutugiii Mutugiii requested a review from Copilot January 26, 2026 21:13
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR standardizes loading state patterns across the application by introducing a reusable PlanetLoadingSpinnerComponent and refactoring loading logic to use consistent patterns with proper cleanup via finalize operators.

Changes:

  • Created PlanetLoadingSpinnerComponent for consistent loading UI across all pages
  • Refactored DialogsLoadingService to use reference counting for nested loading states
  • Standardized loading state management in components using finalize and error handling

Reviewed changes

Copilot reviewed 47 out of 48 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/app/shared/planet-loading-spinner.component.ts New reusable loading spinner component with customizable text
src/app/shared/shared-components.module.ts Registered the new loading spinner component
src/app/shared/dialogs/dialogs-loading.service.ts Added reference counting to prevent premature dialog closure
src/app/users/users-table.component.html Replaced inline loading text with spinner component
src/app/teams/teams-view.component.ts Split loading states and added proper error handling
src/app/teams/teams-view.component.html Added loading spinners for news and member data
src/app/surveys/surveys.component.ts Added conditional dialog loading based on route context
src/app/resources/view-resources/resources-view.component.ts Removed dialog loading service and added error handling
src/app/manager-dashboard/reports/reports-detail.component.ts Added loading states and computed property for summary loading
src/app/dashboard/dashboard.component.ts Refactored to use finalize for loading state cleanup
src/app/exams/exams-view.component.ts Replaced custom spinner state with dialog loading service
src/app/courses/courses.component.ts Added error handler for loading state cleanup
src/app/community/community.component.ts Split single loading state into multiple granular states
src/app/chat/chat-sidebar/chat-sidebar.component.ts Added loading state with proper initialization and cleanup

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +107 to 109
).subscribe(tasks => {
this.tasks = tasks;
this.setTasks(tasks);
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The subscription lacks error handling. If any observable in the pipe chain fails, the loading states may not be properly reset. Add an error handler to the subscribe call.

Suggested change
).subscribe(tasks => {
this.tasks = tasks;
this.setTasks(tasks);
).subscribe({
next: (tasks) => {
this.tasks = tasks;
this.setTasks(tasks);
},
error: (error) => {
console.error('Error while loading tasks in TeamsViewComponent:', error);
}

Copilot uses AI. Check for mistakes.
return of([]);
}
this.financesLoading = true;
this.teamDataLoading = true;
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The loading state is set to true here but there's no corresponding error handler in the chain starting at line 213 to reset it to false if the observable fails. This could leave the UI in a perpetual loading state.

Copilot uses AI. Check for mistakes.
Comment on lines +97 to +100
get summaryLoading() {
return this.loginLoading || this.resourcesLoading ||
this.coursesLoading || this.chatLoading || this.voicesLoading || this.progressLoading;
}
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This getter is called on every change detection cycle, recalculating the boolean expression each time. Consider computing this value once when the individual loading states change, or use memoization.

Copilot uses AI. Check for mistakes.
? this.dateQueryParams.startDate : new Date(new Date().setMonth(new Date().getMonth() - 12))
);
this.setLoginActivities();
this.loginLoading = false;
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The subscription starting at line 268 lacks an error handler. If the observable fails, loginLoading will remain true, potentially blocking UI updates.

Copilot uses AI. Check for mistakes.
Comment on lines 58 to +60
).subscribe((responses) => {
this.setMembers(responses);
this.isLoading = false;
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The subscription starting at line 54 lacks error handling. If the observable fails, isLoading will remain true.

Suggested change
).subscribe((responses) => {
this.setMembers(responses);
this.isLoading = false;
).subscribe({
next: (responses) => {
this.setMembers(responses);
this.isLoading = false;
},
error: () => {
this.isLoading = false;
}

Copilot uses AI. Check for mistakes.
</ng-template>
</mat-tab>
<mat-tab [label]="leadersTabLabel" *ngIf="isLoggedIn">
<p *ngIf="councillors.length === 0" i18n>No leaders available.</p>
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This message appears unconditionally when the array is empty, even during initial loading. Consider adding a loading state check to avoid showing 'No leaders available' while data is still being fetched.

Suggested change
<p *ngIf="councillors.length === 0" i18n>No leaders available.</p>
<p *ngIf="!communityDataLoading && (!councillors || councillors.length === 0)" i18n>No leaders available.</p>

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants