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

syncControls() overwrites attributes set from a component internally #81

Open
HenrikHildebrand opened this issue Oct 29, 2024 · 1 comment

Comments

@HenrikHildebrand
Copy link

Context

We have an input component, which has custom-invalid as an attribute. custom-invalid is controlled from storybook and when set, it sets invalid on the host from the inside and out. We use invalid to determine the styling of the input.

Problem

It appears that when invalid is set, the call to syncControls() in the template function removes the invalid attribute since it's not part of the controls or arguments.

Possible solution

We don't understand the purpose of syncControls() fully and we did a fork and removed that line in getTemplate() which seems to solve our problem. It doesn't seem to cause any other issues with our storybook AFAIK.

@break-stuff
Copy link
Owner

That function syncs the attributes with the Storybook controls. If attributes are updated from within the component, it will update the values in the control.

Is the invalid attribute settable or is it a side effect from the custom-invalid attribute being set?

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

No branches or pull requests

2 participants