diff options
author | 2023-08-15 18:31:01 -0400 | |
---|---|---|
committer | 2023-08-15 17:31:01 -0500 | |
commit | 0bf2cca5d7fe1fb025feae00ab3c12ed80f9ea9a (patch) | |
tree | 4d5023eb9af84f8388ef7e5a8c06a69b17d79eb9 /packages/integrations/react/src | |
parent | 0b59bc944b18913bd985f01b514e7416aa167324 (diff) | |
download | astro-0bf2cca5d7fe1fb025feae00ab3c12ed80f9ea9a.tar.gz astro-0bf2cca5d7fe1fb025feae00ab3c12ed80f9ea9a.tar.zst astro-0bf2cca5d7fe1fb025feae00ab3c12ed80f9ea9a.zip |
Filter out Svelte's unknown class prop console warnings (#7291)
* Filter out Svelte's unexpected class prop console warnings
Astro's hydration code passes a `class` prop to Svelte components, inducing Svelte to log a warning about an unknown prop. Preempting this by exporting a `class` prop from the Svelte component isn't a viable workaround since `class` is a reserved identifier in JS.
This PR implements the console-filtering workaround suggested by @HiDeoo in #5665, borrowing the `useConsoleFilter` approach from the [preact integration](https://github.com/withastro/astro/blob/a1c0cbe604c9f91cdc421b5606aab574999eba01/packages/integrations/preact/src/server.ts#L72-L94).
It would probably be better to generalize console filtering so it could be shared across multiple integrations.
Ideally there would be a way to handle this in Svelte, but as was pointed out in the issue thread even they resort to [similar cringe-inducing hackery](https://github.com/sveltejs/kit/blob/master/packages/kit/src/runtime/client/client.js#L1974-L1996) in sveltekit.
* Only filter Svelte console warnings in dev builds
* Add changeset
* Fix lint error.
---------
Co-authored-by: bluwy <bjornlu.dev@gmail.com>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
Diffstat (limited to 'packages/integrations/react/src')
0 files changed, 0 insertions, 0 deletions