Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter out Svelte's unknown data prop warnings #9510

Merged
merged 5 commits into from
Dec 27, 2023
Merged

Conversation

nikhilk
Copy link
Contributor

@nikhilk nikhilk commented Dec 24, 2023

Changes

The existing console filter looked for class attributes. This change adds a check for warnings related to data attributes as well.

  • Before/after screenshots can help as well.
  • Don't forget a changeset! pnpm exec changeset

Testing

Tested by validating the change in a simple Astro app with a Svelte counter component.

Before the fix, the console output contains the following warning:

<Counter> was created with unknown prop 'data-astro-cid-j7pv25f6'

After patching client.js in node_modules and clearing the cache:

rm -rf ./node_modules/.vite

Run the app again

npm run dev

The console output is now clear, without any warnings.

Docs

N/A - no docs need to be updated. This only removes console warnings, which was already happening automatically.

Fixes withastro#9508

The existing console filter looked for class attributes. This change adds a check for warnings related to data attributes as well.
Copy link

changeset-bot bot commented Dec 24, 2023

🦋 Changeset detected

Latest commit: ace47d4

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added pkg: svelte Related to Svelte (scope) pkg: integration Related to any renderer integration (scope) labels Dec 24, 2023
@github-actions github-actions bot added the pr: docs A PR that includes documentation for review label Dec 24, 2023
Switch from string.indexOf to string.includes.
Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@bluwy bluwy merged commit cf993bc into withastro:main Dec 27, 2023
13 checks passed
@astrobot-houston astrobot-houston mentioned this pull request Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: integration Related to any renderer integration (scope) pkg: svelte Related to Svelte (scope) pr: docs A PR that includes documentation for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Svelte island does not expect unknown props, causes warning
2 participants