Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp authored and astrobot-houston committed May 23, 2023
1 parent 904131a commit bf2320e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
13 changes: 6 additions & 7 deletions packages/astro/src/core/render/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type {
SSRLoadedRenderer,
SSRResult,
} from '../../@types/astro';
import { isHTMLString } from '../../runtime/server/escape.js';
import {
renderSlotToString,
stringifyChunk,
Expand All @@ -18,7 +19,6 @@ import { renderJSX } from '../../runtime/server/jsx.js';
import { AstroCookies } from '../cookies/index.js';
import { AstroError, AstroErrorData } from '../errors/index.js';
import { warn, type LogOptions } from '../logger/core.js';
import { isHTMLString } from '../../runtime/server/escape.js';

const clientAddressSymbol = Symbol.for('astro.clientAddress');
const responseSentSymbol = Symbol.for('astro.responseSent');
Expand Down Expand Up @@ -111,12 +111,11 @@ class Slots {
// Astro
const expression = getFunctionExpression(component);
if (expression) {
const slot = async () => isHTMLString(await expression) ? expression : expression(...args)
return await renderSlotToString(result, slot).then((res) =>{
return res != null ? String(res) : res
}

);
const slot = async () =>
isHTMLString(await expression) ? expression : expression(...args);
return await renderSlotToString(result, slot).then((res) => {
return res != null ? String(res) : res;
});
}
// JSX
if (typeof component === 'function') {
Expand Down
4 changes: 3 additions & 1 deletion packages/astro/src/runtime/server/render/slot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import { renderChild } from './any.js';

type RenderTemplateResult = ReturnType<typeof renderTemplate>;
export type ComponentSlots = Record<string, ComponentSlotValue>;
export type ComponentSlotValue = (result: SSRResult) => RenderTemplateResult | Promise<RenderTemplateResult>;
export type ComponentSlotValue = (
result: SSRResult
) => RenderTemplateResult | Promise<RenderTemplateResult>;

const slotString = Symbol.for('astro:slot-string');

Expand Down
4 changes: 2 additions & 2 deletions packages/astro/test/set-html.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('set:html', () => {
expect(res.status).to.equal(200);
let html = await res.text();
expect(html).include('Test');
})
});
});

describe('Build', () => {
Expand Down Expand Up @@ -87,6 +87,6 @@ describe('set:html', () => {
it('test Fragment when Fragment is as a slot', async () => {
let res = await fixture.readFile('/children/index.html');
expect(res).include('Test');
})
});
});
});

0 comments on commit bf2320e

Please sign in to comment.