Skip to content

Commit d20dd71

Browse files
committed
Revert "Trigger greeting reload by clicking the app title"
The header logo's click handler in AppComponent required injecting GreetingService into the application shell, which instantiated the greeting resource at bootstrap and broke the AI-generated-greeting e2e test (introduced in PR #54, commit 6047dec). Restore the dedicated refresh button on the home page so the resource is only created from within the authenticated route, matching the working state of PR #53. https://claude.ai/code/session_01GD8tXttFntAmxFRZ8vJnrh
1 parent e08ad55 commit d20dd71

5 files changed

Lines changed: 22 additions & 7 deletions

File tree

client/src/app/app.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<mat-toolbar class="header">
22
<nav>
3-
<a mat-button routerLink="" (click)="reloadGreeting()">Skeleton App</a>
3+
<a mat-button routerLink="">Skeleton App</a>
44
@if(isAuthenticated()) {
55
<div class="header-right">
66
<app-header></app-header>

client/src/app/app.component.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { MatTooltipModule } from '@angular/material/tooltip';
55
import { RouterLink, RouterOutlet } from '@angular/router';
66
import { HeaderComponent } from './header/header.component';
77
import { AuthService } from './auth.service';
8-
import { GreetingService } from './greeting.service';
98

109
@Component({
1110
selector: 'app-root',
@@ -21,10 +20,5 @@ import { GreetingService } from './greeting.service';
2120
styleUrl: './app.component.css',
2221
})
2322
export class AppComponent {
24-
private readonly greetingService = inject(GreetingService);
2523
isAuthenticated = inject(AuthService).isAuthenticated;
26-
27-
reloadGreeting() {
28-
this.greetingService.greeting.reload();
29-
}
3024
}

client/src/app/home/home.component.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
padding: 0 2rem;
66
}
77

8+
.page-toolbar {
9+
display: flex;
10+
justify-content: flex-end;
11+
margin-bottom: 0.5rem;
12+
}
13+
814
h1 {
915
color: var(--bt-text-strong);
1016
margin-bottom: 0.5rem;

client/src/app/home/home.component.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
<div class="page-toolbar">
2+
<button
3+
mat-icon-button
4+
aria-label="Refresh greeting"
5+
(click)="greeting.reload()"
6+
[disabled]="greeting.isLoading()"
7+
>
8+
<mat-icon>refresh</mat-icon>
9+
</button>
10+
</div>
11+
112
@if (greeting.isLoading()) {
213
<bt-bar-loader class="page-loading" label="Loading greeting" />
314
} @else {

client/src/app/home/home.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { Component, inject } from '@angular/core';
2+
import { MatButtonModule } from '@angular/material/button';
23
import { MatCardModule } from '@angular/material/card';
4+
import { MatIconModule } from '@angular/material/icon';
35
import { BarLoaderComponent } from '@mucsi96/angular-material-theme';
46
import { GreetingService } from '../greeting.service';
57

@@ -8,7 +10,9 @@ import { GreetingService } from '../greeting.service';
810
standalone: true,
911
imports: [
1012
BarLoaderComponent,
13+
MatButtonModule,
1114
MatCardModule,
15+
MatIconModule,
1216
],
1317
templateUrl: './home.component.html',
1418
styleUrl: './home.component.css',

0 commit comments

Comments
 (0)