summaryrefslogtreecommitdiff
path: root/packages/integrations/svelte/client.js
diff options
context:
space:
mode:
authorGravatar Nikhil Kothari <nikhilk@users.noreply.github.com> 2023-12-27 02:08:20 -0800
committerGravatar GitHub <noreply@github.com> 2023-12-27 18:08:20 +0800
commitcf993bc263b58502096f00d383266cd179f331af (patch)
treea8f3c58f35aa8372d91241d5e3cfac4f03e1b0fc /packages/integrations/svelte/client.js
parent0ee255ae36969361d87fcd424d83fd9aa7b34b7a (diff)
downloadastro-cf993bc263b58502096f00d383266cd179f331af.tar.gz
astro-cf993bc263b58502096f00d383266cd179f331af.tar.zst
astro-cf993bc263b58502096f00d383266cd179f331af.zip
Filter out Svelte's unknown data prop warnings (#9510)
Diffstat (limited to 'packages/integrations/svelte/client.js')
-rw-r--r--packages/integrations/svelte/client.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/packages/integrations/svelte/client.js b/packages/integrations/svelte/client.js
index 9e3df4019..51d60ac8f 100644
--- a/packages/integrations/svelte/client.js
+++ b/packages/integrations/svelte/client.js
@@ -104,9 +104,15 @@ function finishUsingConsoleFilter() {
*/
function filteredConsoleWarning(msg, ...rest) {
if (consoleFilterRefs > 0 && typeof msg === 'string') {
- // Astro passes a `class` prop to the Svelte component, which
+ // Astro passes `class` and `data-astro-cid` props to the Svelte component, which
// outputs the following warning, which we can safely filter out.
- const isKnownSvelteError = msg.endsWith("was created with unknown prop 'class'");
+
+ // NOTE: In practice data-astro-cid props have a hash suffix. Hence the use of a
+ // quoted prop name string without a closing quote.
+
+ const isKnownSvelteError =
+ msg.endsWith("was created with unknown prop 'class'") ||
+ msg.includes("was created with unknown prop 'data-astro-cid");
if (isKnownSvelteError) return;
}
originalConsoleWarning(msg, ...rest);