@@ -25,6 +25,7 @@ import { ActivatedRoute, Router, RouterLink } from '@angular/router';
2525
2626import { ENVIRONMENT } from '@core/provider/environment.provider' ;
2727import { HelpScoutService } from '@core/services/help-scout.service' ;
28+ import { PrerenderReadyService } from '@core/services/prerender-ready.service' ;
2829import { ClearCurrentProvider } from '@core/store/provider' ;
2930import { UserSelectors } from '@core/store/user' ;
3031import { ResetState } from '@osf/features/files/store' ;
@@ -101,6 +102,7 @@ export class PreprintDetailsComponent implements OnInit, OnDestroy {
101102 private readonly datePipe = inject ( DatePipe ) ;
102103 private readonly dataciteService = inject ( DataciteService ) ;
103104 private readonly analyticsService = inject ( AnalyticsService ) ;
105+ private readonly prerenderReady = inject ( PrerenderReadyService ) ;
104106
105107 private readonly environment = inject ( ENVIRONMENT ) ;
106108
@@ -124,8 +126,8 @@ export class PreprintDetailsComponent implements OnInit, OnDestroy {
124126 preprint = select ( PreprintSelectors . getPreprint ) ;
125127 preprint$ = toObservable ( select ( PreprintSelectors . getPreprint ) ) ;
126128 isPreprintLoading = select ( PreprintSelectors . isPreprintLoading ) ;
127- contributors = select ( ContributorsSelectors . getContributors ) ;
128- areContributorsLoading = select ( ContributorsSelectors . isContributorsLoading ) ;
129+ contributors = select ( ContributorsSelectors . getBibliographicContributors ) ;
130+ areContributorsLoading = select ( ContributorsSelectors . isBibliographicContributorsLoading ) ;
129131 reviewActions = select ( PreprintSelectors . getPreprintReviewActions ) ;
130132 areReviewActionsLoading = select ( PreprintSelectors . arePreprintReviewActionsLoading ) ;
131133 withdrawalRequests = select ( PreprintSelectors . getPreprintRequests ) ;
@@ -138,6 +140,7 @@ export class PreprintDetailsComponent implements OnInit, OnDestroy {
138140 areMetricsLoading = select ( PreprintSelectors . arePreprintMetricsLoading ) ;
139141
140142 isPresentModeratorQueryParam = toSignal ( this . route . queryParams . pipe ( map ( ( params ) => params [ 'mode' ] === 'moderator' ) ) ) ;
143+ defaultProvider = this . environment . defaultProvider ;
141144
142145 moderationMode = computed ( ( ) => {
143146 const provider = this . preprintProvider ( ) ;
@@ -170,6 +173,7 @@ export class PreprintDetailsComponent implements OnInit, OnDestroy {
170173
171174 constructor ( ) {
172175 this . helpScoutService . setResourceType ( 'preprint' ) ;
176+ this . prerenderReady . setNotReady ( ) ;
173177
174178 effect ( ( ) => {
175179 const currentPreprint = this . preprint ( ) ;
@@ -178,6 +182,16 @@ export class PreprintDetailsComponent implements OnInit, OnDestroy {
178182 this . analyticsService . sendCountedUsage ( currentPreprint . id , 'preprint.detail' ) . subscribe ( ) ;
179183 }
180184 } ) ;
185+
186+ effect ( ( ) => {
187+ const preprint = this . preprint ( ) ;
188+ const contributors = this . contributors ( ) ;
189+ const isLoading = this . isPreprintLoading ( ) || this . areContributorsLoading ( ) ;
190+
191+ if ( ! isLoading && preprint && contributors . length ) {
192+ this . setMetaTags ( ) ;
193+ }
194+ } ) ;
181195 }
182196
183197 private preprintWithdrawableState = computed ( ( ) => {
@@ -257,7 +271,7 @@ export class PreprintDetailsComponent implements OnInit, OnDestroy {
257271 ) ;
258272 } ) ;
259273
260- isOsfPreprint = computed ( ( ) => this . providerId ( ) === 'osf' ) ;
274+ isOsfPreprint = computed ( ( ) => this . providerId ( ) === this . defaultProvider ) ;
261275
262276 moderationStatusBannerVisible = computed ( ( ) => {
263277 return (
@@ -351,6 +365,8 @@ export class PreprintDetailsComponent implements OnInit, OnDestroy {
351365 }
352366
353367 fetchPreprint ( preprintId : string ) {
368+ this . prerenderReady . setNotReady ( ) ;
369+
354370 this . actions . fetchPreprintById ( preprintId ) . subscribe ( {
355371 next : ( ) => {
356372 this . checkAndSetVersionToTheUrl ( ) ;
@@ -370,8 +386,6 @@ export class PreprintDetailsComponent implements OnInit, OnDestroy {
370386 } ) ;
371387 }
372388 }
373-
374- this . setMetaTags ( ) ;
375389 } ,
376390 } ) ;
377391 }
0 commit comments