-
Notifications
You must be signed in to change notification settings - Fork 1
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
CRDCDH-2189 Compare Differences between Existing/New Data #616
base: 3.2.0
Are you sure you want to change the base?
Conversation
Includes test coverage and UX styling
Pull Request Test Coverage Report for Build 13203556714Details
💛 - Coveralls |
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.
Really great job with this, I personally really like the skeleton look. I left some tiny potential changes. Everything else looks super solid!
return undefined; | ||
} | ||
if ( | ||
!selectedRow?.errors?.some((error) => error.code === "M018") && |
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.
Optional, but just to add some readability, can we assign the error code to a variable or add a comment to describe what the error code "M018" is for?
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.
@Alejandro-Vega I'm thinking we could address this two ways, but I want your thoughts on it:
- We abstract the error codes (M018 in this case, but more down the line) to a configuration file. e.g.
const ValidationErrorCodes = {
UPDATING_DATA: "M018",
// ...
};
- We convert the
ErrorMessage.code
from just astring
to a constrained string union, and just add comments on the type. e.g.
/**
* Represents an error code associated with a validation result.
*
* Breakdown:
* - `M018` - Updating existing data
*/
type ValidationErrorCode = "M018";
type ErrorMessage = {
// ...
code: ValidationErrorCode;
// ...
};
I think both have their pros and cons. If we go the Type direction, it doesn't impact our production bundle sizing (even though it's trivial). But if we go the config direction, it gives us the option to add potentially expand each object in the future (for example, if we needed a FE-dictated tooltip for each error code).
Or if this is an overkill, I can just add a comment as originally commented. Thoughts?
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.
@amattu2 I think both have different benefits. For example, being able to map it to config adds flexibility and easily tells us what it is for. While the constrained string union type doesn't really tell us what any of them are for, but is just useful as a type like in your example.
I suggest we go with a mix of both, but mostly the first option. If we add the as const
we can extract the error code values and use them like in your second suggestion. For example:
export const ValidationErrorCodes = {
UPDATING_DATA: "M018",
UPDATING_DATA_2: "M019",
UPDATING_DATA_3: "M020",
} as const;
export type ValidationErrorCode = (typeof ValidationErrorCodes)[keyof typeof ValidationErrorCodes];
// "M018" | "M019" | "M020"
If you think this is overkill, I would still prefer option 1 to provide us with the most scalability.
* @returns The Repeater component | ||
*/ | ||
const Repeater: FC<RepeaterProps> = ({ children, count }: RepeaterProps) => ( | ||
<>{Array.from({ length: count }, (_, index) => React.cloneElement(children, { key: index }))}</> |
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.
Perhaps adding a required keyPrefix prop and using it as the key value would be safer here. Duplicate keys could lead to weird issues.
Ex.
{Array.from({ length: count }, (_, index) =>
React.cloneElement(children, { key: `${keyPrefix}-${index}` })
)}
width: "100%", | ||
}); | ||
|
||
const StyledTable = styled(Table)({ |
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.
Super hard to tell while zoomed out, but the white background in this table is overflowing at the corners. Adding a borderRadius here should fix this.
Overview
This PR introduces a low-level data comparison between two nodes of the same type, where one was previously submitted, and one is present in an active data submission.
Note
This comparison component utilizes the MUI skeleton to render placeholders while data is loading. This was the best solution I could think of, but it's inconsistent with the rest of the app.
I'm open to alternatives if this doesn't look good.
Change Details (Specifics)
code
to the ErrorMessage type and query it in QCResults APIRelated Ticket(s)
CRDCDH-2189 (Task)
CRDCDH-2149 (US)