Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions apps/blog-app-e2e/tests/app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ test.fixme('should redirect to /blog', async ({ page }) => {
await expect(page).toHaveURL(/\/blog$/);
});

// https://github.com/analogjs/analog/issues/2165
test.fixme('should serve up HTML for pre-rendered markdown route', async ({
test('should serve up HTML for pre-rendered markdown route', async ({
page,
}) => {
await page.goto('/blog/2022-12-27-my-first-post');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import type { StandardSchemaV1 } from '@standard-schema/spec';
import { of } from 'rxjs';
import { describe, expect, it } from 'vitest';

import { CONTENT_FILES_TOKEN } from '../../src/lib/content-files-token';
import { contentFileResource } from './content-file-resource';
import { CONTENT_FILE_LOADER } from '../../src/lib/content-file-loader';
import { ContentRenderer } from '../../src/lib/content-renderer';

const TEST_RESOURCE_TOKEN = new InjectionToken<
Expand Down Expand Up @@ -314,9 +314,8 @@ function setup(args: {
useClass: TestContentRenderer,
},
{
provide: CONTENT_FILE_LOADER,
useValue: async () =>
args.contentFiles as Record<string, () => Promise<string>>,
provide: CONTENT_FILES_TOKEN,
useValue: args.contentFiles as Record<string, () => Promise<string>>,
},
{
provide: TEST_RESOURCE_TOKEN,
Expand Down
8 changes: 3 additions & 5 deletions packages/content/resources/src/content-file-resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@ import {
import { ActivatedRoute } from '@angular/router';

import { toSignal } from '@angular/core/rxjs-interop';
import { from } from 'rxjs';
import { map } from 'rxjs/operators';
import type { ContentFile } from '../../src/lib/content-file';
import { ContentRenderer } from '../../src/lib/content-renderer';
import { injectContentFilesMap } from '../../src/lib/inject-content-files';
Comment thread
coderabbitai[bot] marked this conversation as resolved.
import {
FrontmatterValidationError,
parseRawContentFile,
parseRawContentFileAsync,
} from '../../src/lib/parse-raw-content-file';
import { injectContentFileLoader } from '../../src/lib/content-file-loader';

export interface ContentFileResourceResult<
Attributes extends Record<string, any> = Record<string, any>,
Expand Down Expand Up @@ -200,9 +199,8 @@ export function contentFileResource(
? (paramsOrOptions as { schema?: StandardSchemaV1 }).schema
: undefined;

const loaderPromise = injectContentFileLoader();
const contentRenderer = inject(ContentRenderer);
const contentFilesMap = toSignal(from(loaderPromise()));
const contentFilesMap = injectContentFilesMap();
const input =
params ||
toSignal(
Expand All @@ -213,7 +211,7 @@ export function contentFileResource(
);

return resource({
params: computed(() => ({ input: input(), files: contentFilesMap() })),
params: computed(() => ({ input: input(), files: contentFilesMap })),
loader: async ({ params: resourceParams }) => {
const { input: param, files } = resourceParams;

Expand Down
Loading