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

docs: make legacy.componentApi more visible #11924

Merged
merged 11 commits into from
Jun 6, 2024
Merged

Conversation

dummdidumm
Copy link
Member

People didn't know that this exists, so we should make it more visible through having it be part of the error message, and calling it out in the docs with more details

People didn't know that this exists, so we should make it more visible through having it be part of the error message, and calling it out in the docs with more details
Copy link

changeset-bot bot commented Jun 6, 2024

🦋 Changeset detected

Latest commit: 9847e1a

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

This PR includes changesets to release 1 package
Name Type
svelte Patch

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

@Rich-Harris
Copy link
Member

Trying this out locally and realised that it doesn't actually do anything because of the hmr layer — investigating...

@Rich-Harris
Copy link
Member

fixed

image

@@ -20,6 +21,9 @@ export function hmr(source) {
block(() => {
const component = get(source);

// @ts-expect-error
check_target(new.target && component);
Copy link
Member Author

@dummdidumm dummdidumm Jun 6, 2024

Choose a reason for hiding this comment

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

this does the check and then fail even when the compiler option is set, which shouldn't happen in that case

Copy link
Member

Choose a reason for hiding this comment

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

ah whoops, good catch. fixed. though it now fails with props is undefined, looking into that now

Copy link
Member

Choose a reason for hiding this comment

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

kinda stumped by this tbh, any ideas?

Copy link
Member

Choose a reason for hiding this comment

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

seems that checking for the truthiness of new.target (rather than doing an equality check) makes it work. i don't fully understand why the equality check was failing but i'll take it

@Rich-Harris Rich-Harris merged commit ba017db into main Jun 6, 2024
6 of 8 checks passed
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.

2 participants