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

Svelte: Fix argTypes inference in Button component #20212

Merged
merged 4 commits into from
Dec 13, 2022
Merged

Conversation

JReinhold
Copy link
Contributor

@JReinhold JReinhold commented Dec 12, 2022

This PR fixes a bug in our Svelte renderer components that would mean argTypes were not inferred correctly for the Button component created in TS sandboxes.

#20007 introduces TS specific versions of the sandbox stories, however they missed the fact that sveltedoc-parser doesn't support TypeScript, so argTypes are not inferred from TS types but rather from default values and JSDocs (types being ignored). @kasperpeulen
Therefore, adding a default value will correctly infer it as a string instead of any object.

This error was caught in our E2E tests in CI, because they try to set the text Hello on the button but because it was inferred as an object it needed to be JSON "Hello" to work properly.

I don't understand why CI for #20007 was only running 36 E2E tests, and why the daily test as late as 2 days ago ran all 72 E2E tests not failing on this? Maybe @yannbf or @kasperpeulen can share some knowledge about this?

@JReinhold JReinhold added svelte build Internal-facing build tooling & test updates labels Dec 12, 2022
@JReinhold JReinhold self-assigned this Dec 12, 2022
@JReinhold JReinhold marked this pull request as ready for review December 12, 2022 23:42
Copy link
Member

@tmeasday tmeasday left a comment

Choose a reason for hiding this comment

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

LGTM. Possibly the reasons the tests didn't fail before is the change is in a "renderer cli template" and so wouldn't have shown up in the actual sandbox until the template was regenerated in the daily job. I guess @kasperpeulen changed that in #20100

@tmeasday tmeasday merged commit aa110b9 into next Dec 13, 2022
@tmeasday tmeasday deleted the fix-svelte-argtypes branch December 13, 2022 00:33
@JReinhold
Copy link
Contributor Author

Ah of course, I hadn't thought about the indirection there!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Internal-facing build tooling & test updates svelte
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants