[ci] yarn format
This commit is contained in:
parent
102161761d
commit
b4dcc0f8d3
5 changed files with 21 additions and 21 deletions
|
@ -7,21 +7,21 @@ import type { GetHydrateCallback, HydrateOptions } from '../../@types/astro';
|
|||
export default async function onIdle(astroId: string, options: HydrateOptions, getHydrateCallback: GetHydrateCallback) {
|
||||
const cb = async () => {
|
||||
const roots = document.querySelectorAll(`astro-root[uid="${astroId}"]`);
|
||||
if(roots.length === 0) {
|
||||
if (roots.length === 0) {
|
||||
throw new Error(`Unable to find the root for the component ${options.name}`);
|
||||
}
|
||||
|
||||
let innerHTML: string | null = null;
|
||||
let fragment = roots[0].querySelector(`astro-fragment`);
|
||||
if(fragment == null && roots[0].hasAttribute('tmpl')) {
|
||||
if (fragment == null && roots[0].hasAttribute('tmpl')) {
|
||||
// If there is no child fragment, check to see if there is a template.
|
||||
// This happens if children were passed but the client component did not render any.
|
||||
let template = roots[0].querySelector(`template[data-astro-template]`);
|
||||
if(template) {
|
||||
if (template) {
|
||||
innerHTML = template.innerHTML;
|
||||
template.remove();
|
||||
}
|
||||
} else if(fragment) {
|
||||
} else if (fragment) {
|
||||
innerHTML = fragment.innerHTML;
|
||||
}
|
||||
const hydrate = await getHydrateCallback();
|
||||
|
|
|
@ -5,21 +5,21 @@ import type { GetHydrateCallback, HydrateOptions } from '../../@types/astro';
|
|||
*/
|
||||
export default async function onLoad(astroId: string, options: HydrateOptions, getHydrateCallback: GetHydrateCallback) {
|
||||
const roots = document.querySelectorAll(`astro-root[uid="${astroId}"]`);
|
||||
if(roots.length === 0) {
|
||||
if (roots.length === 0) {
|
||||
throw new Error(`Unable to find the root for the component ${options.name}`);
|
||||
}
|
||||
|
||||
let innerHTML: string | null = null;
|
||||
let fragment = roots[0].querySelector(`astro-fragment`);
|
||||
if(fragment == null && roots[0].hasAttribute('tmpl')) {
|
||||
if (fragment == null && roots[0].hasAttribute('tmpl')) {
|
||||
// If there is no child fragment, check to see if there is a template.
|
||||
// This happens if children were passed but the client component did not render any.
|
||||
let template = roots[0].querySelector(`template[data-astro-template]`);
|
||||
if(template) {
|
||||
if (template) {
|
||||
innerHTML = template.innerHTML;
|
||||
template.remove();
|
||||
}
|
||||
} else if(fragment) {
|
||||
} else if (fragment) {
|
||||
innerHTML = fragment.innerHTML;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,21 +5,21 @@ import type { GetHydrateCallback, HydrateOptions } from '../../@types/astro';
|
|||
*/
|
||||
export default async function onMedia(astroId: string, options: HydrateOptions, getHydrateCallback: GetHydrateCallback) {
|
||||
const roots = document.querySelectorAll(`astro-root[uid="${astroId}"]`);
|
||||
if(roots.length === 0) {
|
||||
if (roots.length === 0) {
|
||||
throw new Error(`Unable to find the root for the component ${options.name}`);
|
||||
}
|
||||
|
||||
let innerHTML: string | null = null;
|
||||
let fragment = roots[0].querySelector(`astro-fragment`);
|
||||
if(fragment == null && roots[0].hasAttribute('tmpl')) {
|
||||
if (fragment == null && roots[0].hasAttribute('tmpl')) {
|
||||
// If there is no child fragment, check to see if there is a template.
|
||||
// This happens if children were passed but the client component did not render any.
|
||||
let template = roots[0].querySelector(`template[data-astro-template]`);
|
||||
if(template) {
|
||||
if (template) {
|
||||
innerHTML = template.innerHTML;
|
||||
template.remove();
|
||||
}
|
||||
} else if(fragment) {
|
||||
} else if (fragment) {
|
||||
innerHTML = fragment.innerHTML;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,21 +5,21 @@ import type { GetHydrateCallback, HydrateOptions } from '../../@types/astro';
|
|||
*/
|
||||
export default async function onLoad(astroId: string, options: HydrateOptions, getHydrateCallback: GetHydrateCallback) {
|
||||
const roots = document.querySelectorAll(`astro-root[uid="${astroId}"]`);
|
||||
if(roots.length === 0) {
|
||||
if (roots.length === 0) {
|
||||
throw new Error(`Unable to find the root for the component ${options.name}`);
|
||||
}
|
||||
|
||||
let innerHTML: string | null = null;
|
||||
let fragment = roots[0].querySelector(`astro-fragment`);
|
||||
if(fragment == null && roots[0].hasAttribute('tmpl')) {
|
||||
if (fragment == null && roots[0].hasAttribute('tmpl')) {
|
||||
// If there is no child fragment, check to see if there is a template.
|
||||
// This happens if children were passed but the client component did not render any.
|
||||
let template = roots[0].querySelector(`template[data-astro-template]`);
|
||||
if(template) {
|
||||
if (template) {
|
||||
innerHTML = template.innerHTML;
|
||||
template.remove();
|
||||
}
|
||||
} else if(fragment) {
|
||||
} else if (fragment) {
|
||||
innerHTML = fragment.innerHTML;
|
||||
}
|
||||
const hydrate = await getHydrateCallback();
|
||||
|
|
|
@ -7,21 +7,21 @@ import type { GetHydrateCallback, HydrateOptions } from '../../@types/astro';
|
|||
*/
|
||||
export default async function onVisible(astroId: string, options: HydrateOptions, getHydrateCallback: GetHydrateCallback) {
|
||||
const roots = document.querySelectorAll(`astro-root[uid="${astroId}"]`);
|
||||
if(roots.length === 0) {
|
||||
if (roots.length === 0) {
|
||||
throw new Error(`Unable to find the root for the component ${options.name}`);
|
||||
}
|
||||
|
||||
let innerHTML: string | null = null;
|
||||
let fragment = roots[0].querySelector(`astro-fragment`);
|
||||
if(fragment == null && roots[0].hasAttribute('tmpl')) {
|
||||
if (fragment == null && roots[0].hasAttribute('tmpl')) {
|
||||
// If there is no child fragment, check to see if there is a template.
|
||||
// This happens if children were passed but the client component did not render any.
|
||||
let template = roots[0].querySelector(`template[data-astro-template]`);
|
||||
if(template) {
|
||||
if (template) {
|
||||
innerHTML = template.innerHTML;
|
||||
template.remove();
|
||||
}
|
||||
} else if(fragment) {
|
||||
} else if (fragment) {
|
||||
innerHTML = fragment.innerHTML;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue