[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> {
|
||||
const { logging, mod, route, routeCache, pathname, ssr} = opts;
|
||||
const { logging, mod, route, routeCache, pathname, ssr } = opts;
|
||||
// Handle dynamic routes
|
||||
let params: Params = {};
|
||||
let pageProps: Props;
|
||||
|
|
|
@ -19,20 +19,22 @@ interface CallGetStaticPathsOptions {
|
|||
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 });
|
||||
const resultInProgress = {
|
||||
rss: [] as RSS[],
|
||||
};
|
||||
|
||||
let staticPaths: GetStaticPathsResult = [];
|
||||
if(mod.getStaticPaths) {
|
||||
staticPaths = (await mod.getStaticPaths({
|
||||
paginate: generatePaginateFunction(route),
|
||||
rss: (data) => {
|
||||
resultInProgress.rss.push(data);
|
||||
},
|
||||
})).flat();
|
||||
if (mod.getStaticPaths) {
|
||||
staticPaths = (
|
||||
await mod.getStaticPaths({
|
||||
paginate: generatePaginateFunction(route),
|
||||
rss: (data) => {
|
||||
resultInProgress.rss.push(data);
|
||||
},
|
||||
})
|
||||
).flat();
|
||||
}
|
||||
|
||||
const keyedStaticPaths = staticPaths as GetStaticPathsResultKeyed;
|
||||
|
|
|
@ -11,14 +11,14 @@ describe('Dynamic pages in SSR', () => {
|
|||
projectRoot: './fixtures/ssr-dynamic/',
|
||||
buildOptions: {
|
||||
experimentalSsr: true,
|
||||
}
|
||||
},
|
||||
});
|
||||
await fixture.build();
|
||||
});
|
||||
|
||||
it('Do not have to implement getStaticPaths', async () => {
|
||||
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 response = await app.render(request, route);
|
||||
const html = await response.text();
|
||||
|
|
Loading…
Reference in a new issue