Skip to content

Commit

Permalink
fix: Fix missing context for CMS content
Browse files Browse the repository at this point in the history
While loading data from CMS we've missed adding the context
  • Loading branch information
tobi-or-not-tobi authored Jul 31, 2024
2 parents 7724cf1 + 29906a8 commit 020edfd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
6 changes: 6 additions & 0 deletions libs/domain/content/src/services/content.providers.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { provideEntity } from '@oryx-frontend/core';
import { Provider } from '@oryx-frontend/di';
import { ExperienceAdapter } from '@oryx-frontend/experience';
import { ContentExperienceAdapter } from './adapter';
Expand All @@ -6,6 +7,7 @@ import {
storyblokProviders,
strapiProviders,
} from './cms';
import { ContentContext } from './content-context';
import { ContentService } from './content.service';
import { DefaultContentService } from './default-content.service';
import { DefaultFontService, FontService } from './font';
Expand All @@ -26,4 +28,8 @@ export const contentProviders: Provider[] = [
...contentfulProviders,
...storyblokProviders,
...strapiProviders,
provideEntity('content', {
service: ContentService,
context: ContentContext.Content,
}),
];
15 changes: 8 additions & 7 deletions libs/domain/product/src/services/product-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import { Provider, inject } from '@oryx-frontend/di';
import { RouteType, RouterService } from '@oryx-frontend/router';
import { featureVersion } from '@oryx-frontend/utilities';
import { Observable, map, of, take } from 'rxjs';
import { Observable, map, of } from 'rxjs';
import { PRODUCT } from '../entity';
import { ProductQualifier } from '../models';

Expand Down Expand Up @@ -35,12 +35,13 @@ export function productContextFallbackFactory(
router = inject(RouterService),
context = inject(ContextService)
): Observable<unknown> {
return router.current().pipe(
take(1),
map((route) =>
route.type === RouteType.Product ? route.params : undefined
)
);
return router
.current()
.pipe(
map((route) =>
route.type === RouteType.Product ? route.params : undefined
)
);
}

export const ProductContextSerializerToken = `${ContextSerializer}${
Expand Down

0 comments on commit 020edfd

Please sign in to comment.