Skip to content

Commit 5c71913

Browse files
timeout extended to 10ms to check SSG
1 parent 01f5853 commit 5c71913

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/app/reader/_components/main-page/posts-list/posts-list.component.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@
8585
@for (post of posts(); track post.id) {
8686
<app-post-card [post]="post"></app-post-card>
8787
}
88+
@if (posts2) {
89+
@for (post of posts2; track post.id) {
90+
<app-post-card [post]="post"></app-post-card>
91+
}
92+
}
8893
</div>
8994
</div>
9095
</div>

src/app/reader/_components/main-page/posts-list/posts-list.component.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@ import {
1010
signal,
1111
WritableSignal,
1212
OnInit,
13+
ChangeDetectorRef,
1314
} from '@angular/core';
1415
import { RouterModule } from '@angular/router';
1516
import { AboutMeComponent } from '../../../../shared/about-me/about-me.component';
1617
import { PostCardComponent } from './post-card/post-card.component';
1718
import { PostsStore } from './posts.store';
1819
import { TagsStore } from '../../../../shared/stores/tags.store';
20+
import { Post } from '../../../../types/supabase';
21+
import { ReaderApiService } from '../../../_services/reader-api.service';
1922

2023
@Component({
2124
selector: 'app-posts-list',
@@ -30,19 +33,22 @@ import { TagsStore } from '../../../../shared/stores/tags.store';
3033
providers: [DatePipe],
3134
templateUrl: './posts-list.component.html',
3235
styleUrl: './posts-list.component.scss',
33-
changeDetection: ChangeDetectionStrategy.OnPush,
36+
changeDetection: ChangeDetectionStrategy.Default,
3437
schemas: [CUSTOM_ELEMENTS_SCHEMA],
3538
})
3639
export class PostsListComponent implements OnInit {
3740
scroll = viewChild<ElementRef<HTMLElement>>('scrollContainer');
3841

3942
postStore = inject(PostsStore);
4043
tagsStore = inject(TagsStore);
44+
cdr = inject(ChangeDetectorRef);
4145

4246
scrollProgress: WritableSignal<number> = signal(0);
4347
posts = this.postStore.posts;
4448
tags = this.tagsStore.tags;
4549
initialTagScrollProgressBarForMobile = 2;
50+
posts2: Post[] | null = null;
51+
postService = inject(ReaderApiService);
4652

4753
constructor() {
4854
this.initializeScrollingForMobileView();
@@ -65,7 +71,13 @@ export class PostsListComponent implements OnInit {
6571
}
6672

6773
private applyPrerenderingHack(): void {
68-
setTimeout(() => {}, 10);
74+
setTimeout(() => {
75+
this.postService.getPosts().then((posts) => {
76+
this.posts2 = posts;
77+
this.cdr.detectChanges();
78+
});
79+
console.log(this.posts());
80+
}, 1000);
6981
}
7082

7183
private initializeScrollingForMobileView(): void {

0 commit comments

Comments
 (0)