-
Notifications
You must be signed in to change notification settings - Fork 90
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
Pod creation dialog state handling is broken #1836
Comments
Lowering the debounce timeout from 500 to 50 or 100 ms makes the tests pass again on Firefox. Of course this is no silver bullet but it shows what the issue is. We debounce and set a value on an old The debounce can be cancelled, but then we need to keep it in state, worth a shot. |
Spent half a day on this there are so very "fun" problems: validationFailed state is a mix:
So one way I thought to fix this was introduce a
This.. I thought worked but doesn't at all because, this is saved in state as So that's not great is it, we could add "publish" to the callback but then we still have:
Another big problem, has no idea of "publish". But in the end, let's ask the question. Why do we have
Does that mean we have to export all internals back to PodCreateModal, not really right? So can we keep validation state in Alternative is passing a useRef() that feels like a hack. The benefit of moving validation to the DynamicListForm is that we can easily implement this in cockpit without breaking the changing much of the current API. |
See #1832 (comment) for the whole investigation so far.
So @jelly concludes that we are doing all the state interaction wrong with validation..
The PodCreateModal has a state
validationFailed
andsetValidationFailed
setter.validationFailed
is pushed to the DynamicListForm as a property:This component has
dynamicListOnValidationChange
which is this function that modifies the state:The value passed comes from PublishPort:
So this modifies React state and then passes it to onValidationChange which is also a same named function in DynamicListForm:
Modifies state again. This seems to be what causes all the inconsistent state issues
Originally posted by @jelly in #1832 (comment)
The text was updated successfully, but these errors were encountered: