-
Notifications
You must be signed in to change notification settings - Fork 69
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
IxToggle checked attribute value ignored by component #481
Comments
Can you please provide more detailed steps to reproduce. I tested it with the following code: https://stackblitz.com/edit/angular-uqxzsw?file=src/toggle.tsx async function APICall(v: boolean) {
return new Promise<boolean>((r) => setTimeout(() => r(!v), 2000));
}
export default () => {
const [toggle, setToggle] = useState(false);
useEffect(() => {
makeSomeApiCall();
}, [setToggle]);
const makeSomeApiCall = async () => {
const result = await APICall(toggle);
setToggle(result);
};
return (
<>
<IxButton onClick={makeSomeApiCall}>Toggle (timeout 2s)</IxButton>
<IxToggle checked={toggle} />
</>
);
}; |
It seems like you are right and the above code actually sets the For now I will just close it. Thank you! |
I think there is still a controlling issue of the component's state. Yes @danielleroux your example shows that you can change the state dynamically. But at the same time the component still ignores the Basically what I am saying is: Given the code <IxToggle checked={true} /> The toggle state should not change by clicking on it. As long as |
@danielleroux @CptGeo do you agree on reopening this issue because of my aforementioned comment? If not I will need to open a new issue. |
If @danielleroux is fine with reopening this instead of creating a new issue, I am also fine with it. |
@robert-wettstaedt @CptGeo We will have another look at this. |
🤖 Hello @CptGeo Your issue will be analyzed and is part of our internal workflow. JIRA: IX-1111 |
What happened?
I noticed that
checked
attribute ofIxToggle
component completely ignores any value assigned to it, except for when the element loads for the first time.That means, that if we for example have a stateful boolean variable of which the value is determined by a successful or failed API request, we are not able to set the
checked
attribute accordingly.In the provided code, you can see the simplest way to reproduce this issue, meaning giving an explicit
false
value to thechecked
attribute. As you will notice the value is completely ignored (except for when the component loads initially).What type of frontend frameware are you seeing the problem on?
React
Which version of iX do you use?
v1.4.1
Code to produce this issue.
The text was updated successfully, but these errors were encountered: