From 51e67e0ab0e6af4f35bda4db8bf0f609c2d8e7c4 Mon Sep 17 00:00:00 2001 From: natemoo-re Date: Tue, 29 Aug 2023 14:32:02 +0000 Subject: [PATCH] [ci] format --- packages/astro/src/runtime/server/astro-island.ts | 12 ++++++++---- packages/integrations/preact/src/client.ts | 10 +++++----- packages/integrations/react/client-v17.js | 4 +++- packages/integrations/solid/src/client.ts | 2 +- packages/integrations/svelte/client.js | 4 ++-- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/packages/astro/src/runtime/server/astro-island.ts b/packages/astro/src/runtime/server/astro-island.ts index e0e09eaec..2c88f0373 100644 --- a/packages/astro/src/runtime/server/astro-island.ts +++ b/packages/astro/src/runtime/server/astro-island.ts @@ -52,10 +52,14 @@ declare const Astro: { public hydrator: any; static observedAttributes = ['props']; disconnectedCallback() { - document.addEventListener('astro:after-swap', () => { - // If element wasn't persisted, fire unmount event - if (!this.isConnected) this.dispatchEvent(new CustomEvent('astro:unmount')) - }, { once: true }) + document.addEventListener( + 'astro:after-swap', + () => { + // If element wasn't persisted, fire unmount event + if (!this.isConnected) this.dispatchEvent(new CustomEvent('astro:unmount')); + }, + { once: true } + ); } connectedCallback() { if (!this.hasAttribute('await-children') || this.firstChild) { diff --git a/packages/integrations/preact/src/client.ts b/packages/integrations/preact/src/client.ts index ad24e886b..b64431130 100644 --- a/packages/integrations/preact/src/client.ts +++ b/packages/integrations/preact/src/client.ts @@ -1,6 +1,6 @@ -import type { SignalLike } from './types'; -import { h, render, hydrate } from 'preact'; +import { h, hydrate, render } from 'preact'; import StaticHtml from './static-html.js'; +import type { SignalLike } from './types'; const sharedSignalMap = new Map(); @@ -32,9 +32,9 @@ export default (element: HTMLElement) => bootstrap( h(Component, props, children != null ? h(StaticHtml, { value: children }) : children), - element, + element ); - + // Preact has no "unmount" option, but you can use `render(null, element)` - element.addEventListener('astro:unmount', () => render(null, element), { once: true }) + element.addEventListener('astro:unmount', () => render(null, element), { once: true }); }; diff --git a/packages/integrations/react/client-v17.js b/packages/integrations/react/client-v17.js index 70bddc353..625dba6bf 100644 --- a/packages/integrations/react/client-v17.js +++ b/packages/integrations/react/client-v17.js @@ -16,5 +16,7 @@ export default (element) => const isHydrate = client !== 'only'; const bootstrap = isHydrate ? hydrate : render; bootstrap(componentEl, element); - element.addEventListener('astro:unmount', () => unmountComponentAtNode(element), { once: true }); + element.addEventListener('astro:unmount', () => unmountComponentAtNode(element), { + once: true, + }); }; diff --git a/packages/integrations/solid/src/client.ts b/packages/integrations/solid/src/client.ts index 66b3767ea..71a7db5e2 100644 --- a/packages/integrations/solid/src/client.ts +++ b/packages/integrations/solid/src/client.ts @@ -43,5 +43,5 @@ export default (element: HTMLElement) => } ); - element.addEventListener('astro:unmount', () => dispose(), { once: true }) + element.addEventListener('astro:unmount', () => dispose(), { once: true }); }; diff --git a/packages/integrations/svelte/client.js b/packages/integrations/svelte/client.js index 99612a580..73cc305c1 100644 --- a/packages/integrations/svelte/client.js +++ b/packages/integrations/svelte/client.js @@ -24,8 +24,8 @@ export default (target) => { hydrate: client !== 'only', $$inline: true, }); - - element.addEventListener('astro:unmount', () => component.$destroy(), { once: true }) + + element.addEventListener('astro:unmount', () => component.$destroy(), { once: true }); } catch (e) { } finally { if (import.meta.env.DEV) finishUsingConsoleFilter();