Skip to content

Commit

Permalink
[ci] yarn format
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp authored and actions-user committed Feb 16, 2022
1 parent 1021617 commit b4dcc0f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
10 changes: 5 additions & 5 deletions packages/astro/src/runtime/client/idle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions packages/astro/src/runtime/client/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
8 changes: 4 additions & 4 deletions packages/astro/src/runtime/client/media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
8 changes: 4 additions & 4 deletions packages/astro/src/runtime/client/only.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions packages/astro/src/runtime/client/visible.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit b4dcc0f

Please sign in to comment.