[ci] format
This commit is contained in:
parent
7b9d042dde
commit
4cfbd402a4
3 changed files with 13 additions and 11 deletions
|
@ -21,7 +21,7 @@ export const enum GetParamsAndPropsError {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getParamsAndProps(opts: GetParamsAndPropsOptions): Promise<[Params, Props] | GetParamsAndPropsError> {
|
export async function getParamsAndProps(opts: GetParamsAndPropsOptions): Promise<[Params, Props] | GetParamsAndPropsError> {
|
||||||
const { logging, mod, route, routeCache, pathname, ssr} = opts;
|
const { logging, mod, route, routeCache, pathname, ssr } = opts;
|
||||||
// Handle dynamic routes
|
// Handle dynamic routes
|
||||||
let params: Params = {};
|
let params: Params = {};
|
||||||
let pageProps: Props;
|
let pageProps: Props;
|
||||||
|
|
|
@ -19,20 +19,22 @@ interface CallGetStaticPathsOptions {
|
||||||
ssr: boolean;
|
ssr: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function callGetStaticPaths({ isValidate, logging, mod, route, ssr}: CallGetStaticPathsOptions): Promise<RouteCacheEntry> {
|
export async function callGetStaticPaths({ isValidate, logging, mod, route, ssr }: CallGetStaticPathsOptions): Promise<RouteCacheEntry> {
|
||||||
validateGetStaticPathsModule(mod, { ssr });
|
validateGetStaticPathsModule(mod, { ssr });
|
||||||
const resultInProgress = {
|
const resultInProgress = {
|
||||||
rss: [] as RSS[],
|
rss: [] as RSS[],
|
||||||
};
|
};
|
||||||
|
|
||||||
let staticPaths: GetStaticPathsResult = [];
|
let staticPaths: GetStaticPathsResult = [];
|
||||||
if(mod.getStaticPaths) {
|
if (mod.getStaticPaths) {
|
||||||
staticPaths = (await mod.getStaticPaths({
|
staticPaths = (
|
||||||
paginate: generatePaginateFunction(route),
|
await mod.getStaticPaths({
|
||||||
rss: (data) => {
|
paginate: generatePaginateFunction(route),
|
||||||
resultInProgress.rss.push(data);
|
rss: (data) => {
|
||||||
},
|
resultInProgress.rss.push(data);
|
||||||
})).flat();
|
},
|
||||||
|
})
|
||||||
|
).flat();
|
||||||
}
|
}
|
||||||
|
|
||||||
const keyedStaticPaths = staticPaths as GetStaticPathsResultKeyed;
|
const keyedStaticPaths = staticPaths as GetStaticPathsResultKeyed;
|
||||||
|
|
|
@ -11,14 +11,14 @@ describe('Dynamic pages in SSR', () => {
|
||||||
projectRoot: './fixtures/ssr-dynamic/',
|
projectRoot: './fixtures/ssr-dynamic/',
|
||||||
buildOptions: {
|
buildOptions: {
|
||||||
experimentalSsr: true,
|
experimentalSsr: true,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
await fixture.build();
|
await fixture.build();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Do not have to implement getStaticPaths', async () => {
|
it('Do not have to implement getStaticPaths', async () => {
|
||||||
const app = await fixture.loadSSRApp();
|
const app = await fixture.loadSSRApp();
|
||||||
const request = new Request("http://example.com/123");
|
const request = new Request('http://example.com/123');
|
||||||
const route = app.match(request);
|
const route = app.match(request);
|
||||||
const response = await app.render(request, route);
|
const response = await app.render(request, route);
|
||||||
const html = await response.text();
|
const html = await response.text();
|
||||||
|
|
Loading…
Reference in a new issue