-
Notifications
You must be signed in to change notification settings - Fork 6
fix: Hofixes for the localunit #1624
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
Conversation
|
| const isNewLocalUnit = useMemo(() => { | ||
| if (isObject(previousData)) { | ||
| if (Object.keys(previousData).length <= 0) { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| }, [previousData]); |
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.
| const isNewLocalUnit = useMemo(() => { | |
| if (isObject(previousData)) { | |
| if (Object.keys(previousData).length <= 0) { | |
| return true; | |
| } | |
| } | |
| return false; | |
| }, [previousData]); | |
| const isNewLocalUnit = useMemo(() => { | |
| return isNotDefined(previousData) || Object.keys(previousData).length === 0; | |
| }, [previousData]); | |
|
|
||
| const isSuperUser = !isGuestUser && !!userMe?.is_superuser; | ||
|
|
||
| const isGlobalValidator = !isGuestUser && !!userMe?.is_global_validator; |
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.
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.
@frozenhelium this is specific to local units.
| health, | ||
| ...formValues | ||
| // Note: the cast is safe as we're only trying to | ||
| // remove fields if they exist | ||
| } = removeNull(value) as LocalUnitResponse; | ||
|
|
||
| const { | ||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| modified_by_details: healthModifiedByDetails, | ||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| modified_at: healthModifiedAt, | ||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| modified_by: healthModifiedby, | ||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| created_at: healthCreatedAt, | ||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| created_by_details: healthCreatedByDetails, | ||
| ...formHealthValues | ||
| } = health ?? {}; |
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.
| health, | |
| ...formValues | |
| // Note: the cast is safe as we're only trying to | |
| // remove fields if they exist | |
| } = removeNull(value) as LocalUnitResponse; | |
| const { | |
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | |
| modified_by_details: healthModifiedByDetails, | |
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | |
| modified_at: healthModifiedAt, | |
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | |
| modified_by: healthModifiedby, | |
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | |
| created_at: healthCreatedAt, | |
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | |
| created_by_details: healthCreatedByDetails, | |
| ...formHealthValues | |
| } = health ?? {}; | |
| health = {}, | |
| ...formValues | |
| // Note: the cast is safe as we're only trying to | |
| // remove fields if they exist | |
| } = removeNull(value) as LocalUnitResponse; | |
| const { | |
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | |
| modified_by_details: healthModifiedByDetails, | |
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | |
| modified_at: healthModifiedAt, | |
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | |
| modified_by: healthModifiedby, | |
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | |
| created_at: healthCreatedAt, | |
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | |
| created_by_details: healthCreatedByDetails, | |
| ...formHealthValues | |
| } = health; |
| const newValueKeys = Object.keys(removeNull(newValue)); | ||
| const oldValueKeys = Object.keys(removeNull(oldValue)); | ||
|
|
||
| if (newValueKeys.length !== oldValueKeys.length) { | ||
| return true; | ||
| } |
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.
Lets verify removeNull might not actually remove null, lets verify it
Alternatively we can check length for list of defined values only
| // FIXME: Handle case when there is no change. | ||
| // We need to display message to the user | ||
| const hasDifference = useMemo(() => { | ||
| if (!newValue || !oldValue) { |
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.
Let's use isNotDefined just in case
| @@ -0,0 +1,3 @@ | |||
| .local-unit-view-children-container { | |||
| max-height: 36rem; | |||
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.
Are we trying to set max-height? Lets use min function to ensure that it does not go beyond 100vh for smaller screens
| const revertChangesFormError = getErrorObject(revertChangesError); | ||
|
|
||
| const previousData = ( | ||
| localUnitPreviousResponse?.previous_data_details as unknown as LocalUnitResponse |
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.
Let's add FIXME or NOTE why we're casting this
53d8804 to
0cbfd7f
Compare
0cbfd7f to
2a0f3a9
Compare
|
This PR has been shifted to #1940 with proper naming and commits |
Summary
Small hotfixes for the locaunit
Addresses
Depends On
Changes
This PR Ensures:
console.logstatements meant for debugging