Replies: 1 comment 2 replies
-
it seems you just don't register the dependency try adding something like const timeVal = time.val;
if (timeSelectorFragmentValues > maxTime)
time = timeVal; this will allow you to register the dependency regardless of the result of the condition |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What I have
Currently working on a "time selector", it consists of a few input fields (sec/min/ms) and outputs the combined total of milliseconds on every input.
When this ms total is output, the timeSelector validates this amount, re-converts it into ms/sec/min which re-updates the inputs with correct values.
The problem
When the inputs return more milliseconds than allowed, it gets capped off with the highest allowed value.
The problem is that if the inputs return too many milliseconds again, the same max value will be applied again, which causes no re-render to trigger. This means the input fields never get rerendered/cleaned and starts allowing the user to input a bunch of crazy values.
Solution?
Is it possible to always rerender a state variable when its set, regardless of wether its value changed? Is there a different way to set this up that solves this issue? I'd love to hear
Apologies for the gif/image spam, im not good at explaining.
Beta Was this translation helpful? Give feedback.
All reactions