[ci] format
This commit is contained in:
parent
7e19e8b30d
commit
b5269bee4d
3 changed files with 12 additions and 8 deletions
|
@ -105,7 +105,7 @@ export function extractDirectives(
|
||||||
extracted.props[key] = value;
|
extracted.props[key] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(const sym of Object.getOwnPropertySymbols(inputProps)) {
|
for (const sym of Object.getOwnPropertySymbols(inputProps)) {
|
||||||
extracted.props[sym] = inputProps[sym];
|
extracted.props[sym] = inputProps[sym];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ class Skip {
|
||||||
haveNoTried() {
|
haveNoTried() {
|
||||||
return this.count === 0;
|
return this.count === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
isCompleted() {
|
isCompleted() {
|
||||||
return this.count > 2;
|
return this.count > 2;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ export async function renderJSX(result: SSRResult, vnode: any): Promise<any> {
|
||||||
|
|
||||||
// Extract the skip from the props, if we've already attempted a previous render
|
// Extract the skip from the props, if we've already attempted a previous render
|
||||||
let skip: Skip;
|
let skip: Skip;
|
||||||
if(vnode.props[Skip.symbol]) {
|
if (vnode.props[Skip.symbol]) {
|
||||||
skip = vnode.props[Skip.symbol];
|
skip = vnode.props[Skip.symbol];
|
||||||
} else {
|
} else {
|
||||||
skip = new Skip(vnode);
|
skip = new Skip(vnode);
|
||||||
|
@ -107,7 +107,7 @@ Did you forget to import the component or is it possible there is a typo?`);
|
||||||
return await renderJSX(result, output);
|
return await renderJSX(result, output);
|
||||||
}
|
}
|
||||||
if (typeof vnode.type === 'function') {
|
if (typeof vnode.type === 'function') {
|
||||||
if(skip.haveNoTried() || skip.isCompleted()) {
|
if (skip.haveNoTried() || skip.isCompleted()) {
|
||||||
useConsoleFilter();
|
useConsoleFilter();
|
||||||
try {
|
try {
|
||||||
const output = await vnode.type(vnode.props ?? {});
|
const output = await vnode.type(vnode.props ?? {});
|
||||||
|
@ -119,9 +119,8 @@ Did you forget to import the component or is it possible there is a typo?`);
|
||||||
renderResult = await renderJSXVNode(result, output, skip);
|
renderResult = await renderJSXVNode(result, output, skip);
|
||||||
return renderResult;
|
return renderResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
if(skip.isCompleted()) {
|
if (skip.isCompleted()) {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
skip.increment();
|
skip.increment();
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
|
|
||||||
import { createComponent, render, renderComponent, renderSlot } from '../../../dist/runtime/server/index.js';
|
import {
|
||||||
|
createComponent,
|
||||||
|
render,
|
||||||
|
renderComponent,
|
||||||
|
renderSlot,
|
||||||
|
} from '../../../dist/runtime/server/index.js';
|
||||||
import { jsx } from '../../../dist/jsx-runtime/index.js';
|
import { jsx } from '../../../dist/jsx-runtime/index.js';
|
||||||
import {
|
import {
|
||||||
createBasicEnvironment,
|
createBasicEnvironment,
|
||||||
|
@ -106,7 +111,7 @@ describe('core/render', () => {
|
||||||
try {
|
try {
|
||||||
await response.text();
|
await response.text();
|
||||||
expect(false).to.equal(true, 'should not have been successful');
|
expect(false).to.equal(true, 'should not have been successful');
|
||||||
} catch(err) {
|
} catch (err) {
|
||||||
expect(err.message).to.equal('uh oh');
|
expect(err.message).to.equal('uh oh');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue