Skip to content

chore: add test to show usage of context in component template #11061

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

Merged
merged 2 commits into from
Apr 9, 2024

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented Apr 4, 2024

Ensures Svelte 5 tackles the issue in #7549 for client side usage of getContext in places where it's not valid to be used.

Copy link

changeset-bot bot commented Apr 4, 2024

⚠️ No Changeset found

Latest commit: cd12fa9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@Rich-Harris
Copy link
Member

nice! can we get a test up in here though? 🙏

@brunnerh
Copy link
Member

brunnerh commented Apr 4, 2024

This is a significant breaking change with v4, that sort of code is out there, I've seen it.
Sometimes not intentionally because the call is behind some other API.

@Rich-Harris
Copy link
Member

Blurgh. Is our conclusion from that 'make this a warning in 5 and an error in 6', or 'don't change it'?

@trueadm
Copy link
Contributor Author

trueadm commented Apr 4, 2024

Should I make this a warning then or close it? I'm happy to do either. We could also make it an error in runes mode only?

@Rich-Harris
Copy link
Member

Also encountered this pattern. I think these use cases are legitimate. So I guess I lean towards 'close it' (though maybe we should add a test to make sure we don't accidentally break this)

@trueadm trueadm changed the title chore: prevent usage of getContext during component template chore: add test to show usage of context in component template Apr 9, 2024
@trueadm
Copy link
Contributor Author

trueadm commented Apr 9, 2024

Cool. Rather than close this and lose context, I just repurposed the PR to add a test case to ensure we can continue to use context in the template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants