From b4dcc0f8d38a2b520154fb9b80f7f04e14aec248 Mon Sep 17 00:00:00 2001 From: matthewp Date: Wed, 16 Feb 2022 15:13:06 +0000 Subject: [PATCH] [ci] yarn format --- packages/astro/src/runtime/client/idle.ts | 10 +++++----- packages/astro/src/runtime/client/load.ts | 8 ++++---- packages/astro/src/runtime/client/media.ts | 8 ++++---- packages/astro/src/runtime/client/only.ts | 8 ++++---- packages/astro/src/runtime/client/visible.ts | 8 ++++---- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/packages/astro/src/runtime/client/idle.ts b/packages/astro/src/runtime/client/idle.ts index 6a5bf15e1..4d7d52245 100644 --- a/packages/astro/src/runtime/client/idle.ts +++ b/packages/astro/src/runtime/client/idle.ts @@ -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(); diff --git a/packages/astro/src/runtime/client/load.ts b/packages/astro/src/runtime/client/load.ts index 73bb441cf..a9a6fcf6b 100644 --- a/packages/astro/src/runtime/client/load.ts +++ b/packages/astro/src/runtime/client/load.ts @@ -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; } diff --git a/packages/astro/src/runtime/client/media.ts b/packages/astro/src/runtime/client/media.ts index f5ae240c1..56d67d95f 100644 --- a/packages/astro/src/runtime/client/media.ts +++ b/packages/astro/src/runtime/client/media.ts @@ -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; } diff --git a/packages/astro/src/runtime/client/only.ts b/packages/astro/src/runtime/client/only.ts index cc4efb99d..472a6badd 100644 --- a/packages/astro/src/runtime/client/only.ts +++ b/packages/astro/src/runtime/client/only.ts @@ -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(); diff --git a/packages/astro/src/runtime/client/visible.ts b/packages/astro/src/runtime/client/visible.ts index 101551ec0..1e6f7ea3c 100644 --- a/packages/astro/src/runtime/client/visible.ts +++ b/packages/astro/src/runtime/client/visible.ts @@ -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; }