-
Notifications
You must be signed in to change notification settings - Fork 214
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
(Refactor) Use final form step three #767
Conversation
…use-final-form-step-three # Conflicts: # src/components/stepThree/index.js
…use-final-form-step-three
@dennis00010011b this PR sligtly changed the DOM structure of the Step Three, and is giving errors with e2e tests. |
@fernandomg I've updated e2e script, test for upload CSV should work now. |
/> | ||
) : null} | ||
<p className="description">Slow is cheap, fast is expensive</p> | ||
<Error name="gasPrice"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name shouldn't be hardcoded here, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
} | ||
|
||
export const Error = ({ name, errorStyle }) => ( | ||
<Field |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand this. Is the Field
component really necessary? Couldn't we just receive the whole meta
object from props and use that?
If I'm understanding this correctly, this means that we'll have two Field
s with the same name
attribute, but one of them is used only to show errors. It doesn't sound right to me, is there a good reason for this approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a way to make the Error
component react only to a subset of items' changes (subscription
) for the specified field.
* But it worked for me to keep the error messages properly updated for the minCap field. | ||
*/ | ||
} | ||
<Field name="minCap" subscription={{}}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here thing (as in the Error component). Is the Field necessary? Can't we use the change
function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change
function is a Form
's property, which will force us to transfer props
from StepThreeForm
to TierBlock
.
Whereas keeping the current approach makes easier for us to extend this sole component, without needing to modify any parent component.
@dennis00010011b I've been running the e2e locally and it is still failing. This are the lists of issues that I found:
As a note, with this migration to If you find yourself using XPath to reach a particular element, don't hesitate in request a change in the code to add an |
@fernandomg Thank you for feedback.
|
This is another step towards the completion of #711
In this PR
StepTree
was moved entirely intofinal-form
, with the exception of whitelist which is now part ofstepThreeForm
(similar to what was done withreservedTokens
instepTwo
).I didn't manage to prevent error messages for
rate
andsupply
for the Tiers added after the first one. This won't affect the UX, but will display the errors by default.Besides I've created an
Error
component, which makes easier to display errors related tofinal-form
Fields.This looks still as a WIP, but the idea is to keep moving toward the adoption of
final-form
as fast as possible.