@@ -10,12 +10,15 @@ import {
1010 signal ,
1111 WritableSignal ,
1212 OnInit ,
13+ ChangeDetectorRef ,
1314} from '@angular/core' ;
1415import { RouterModule } from '@angular/router' ;
1516import { AboutMeComponent } from '../../../../shared/about-me/about-me.component' ;
1617import { PostCardComponent } from './post-card/post-card.component' ;
1718import { PostsStore } from './posts.store' ;
1819import { 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} )
3639export 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