You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hopefully this will be an easy one, I'm convinced I just can't see the wood from the trees and it will be something obvious I'm missing.
I have a switch which controls the active state of something, when the switch is toggled there is an API call which will do it's thing and persist this change. Most of the time all is good and everything works, but there might be the odd occasion where something goes wrong and the request cannot be completed so I want to revert the switch state back. I've tried a few things and every time when things fail I have a switch whose state does not match the actual state. Hopefully the codepen demonstrates the issue, am I missing something or is this just a limitation (by design or otherwise) I'm encountering?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hopefully this will be an easy one, I'm convinced I just can't see the wood from the trees and it will be something obvious I'm missing.
I have a switch which controls the active state of something, when the switch is toggled there is an API call which will do it's thing and persist this change. Most of the time all is good and everything works, but there might be the odd occasion where something goes wrong and the request cannot be completed so I want to revert the switch state back. I've tried a few things and every time when things fail I have a switch whose state does not match the actual state. Hopefully the codepen demonstrates the issue, am I missing something or is this just a limitation (by design or otherwise) I'm encountering?
https://codepen.io/nyami/pen/PoNeWzz?editors=1010
Cheers
Doug
Beta Was this translation helpful? Give feedback.
All reactions