Skip to content
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

RHSTOR-6347: Enable recipe-based DR enrollment for discovered applications #1589

Merged

Conversation

GowthamShanmugam
Copy link
Contributor

No description provided.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Sep 19, 2024

@GowthamShanmugam: This pull request references RHSTOR-6347 which is a valid jira issue.

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.


const prevLoader = React.useRef<PromiseComponent>(null);

const setComponent = React.useCallback(
(value) => {
Component.current = value;
setLoaded(true);
if (mounted.current) {
setLoaded(true);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To fix unit test case waring, React state update on an unmounted component

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious: there are other state variables too, why jest is complaining only about this one in particular ??
Also, why doesn't it do so for other components that we have in this repo, why only this ??

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we sure there isn't some other reason for this warning ??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I verified in the console warning that this error is only being raised in jest, and I am not receiving it. The async function's state update, which was carried out after the component unmounts, is the cause of this error. This is occurring as a result of the jest test case being executed more quickly.

adding act() function has resolved this issue.

@@ -295,23 +294,23 @@ export const PVCDetailsWizardContent: React.FC<PVCDetailsWizardContentProps> =
return (
<Form>
<FormGroup>
<Text>
<span>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To fix unit test case waring, div cannot appear as a descendant of p

@GowthamShanmugam
Copy link
Contributor Author

Screenshot 2024-10-07 at 4 20 28 PM

@@ -152,7 +156,7 @@ export const SelectableTable: SelectableTableProps = <
onSelect: onSelect,
isSelected: isRowSelected(getUID(row), selectedRows),
isDisabled:
!isRowSelectable?.(row) ||
(!!isRowSelectable && !isRowSelectable?.(row)) ||
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not needed... !isRowSelectable?.(row) syntax will only execute when function exists, else not...

Suggested change
(!!isRowSelectable && !isRowSelectable?.(row)) ||
(!isRowSelectable?.(row) ||

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

original line was correct...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue in original condition is,
isRowSelectable?: IsRowSelectable; is mentioned as optional. But if the component is not passing isRowSelectable, then !isRowSelectable?.(row)always returns True, and all the rows are disabled by default. It's not correct.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it !!
then probably we can remove ?. part entirely... it's not needed when we are using condition like !!isRowSelectable && ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack, is it won't affect fusion UI? i think fusion is using this table

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should not affect in this case...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh! got it. which ? part you have mentioned

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant using !!isRowSelectable && !isRowSelectable(row)) instead of !!isRowSelectable && !isRowSelectable?.(row)).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?., when we optionally call isRowSelectable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack, changes done

@@ -47,13 +47,18 @@ const useAsynchronousLoading: UseAsynchronousLoading = (
const Component = React.useRef<React.ComponentType>(null);
const [loadingStarted, setLoadingStarted] = React.useState(false);
const [loaded, setLoaded] = React.useState(false);
// Mount status for safty state updates
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Mount status for safty state updates
// Mount status for safely state updates

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can remove the comment as well... it's kind of self-explanatory from variable name itself...

@GowthamShanmugam GowthamShanmugam force-pushed the RHSTOR-6347 branch 2 times, most recently from 47a7fc9 to ca5546c Compare October 21, 2024 09:26
Comment on lines 79 to 83
sortedRows?.filter((selectedRow) =>
!!isRowSelectable
? isRowSelectable(selectedRow)
: true && hasNoDeletionTimestamp(selectedRow)
) || [];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this ??
sortedRows?.filter(isRowSelectable || hasNoDeletionTimestamp) || []; format is correct, filter takes a callback as it's argument.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even if isRowSelectable is undefined here that should work as expected...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right! my bad

// fireEvent.click(screen.getByText('Recipe'));
// fireEvent.click(screen.getByText('Select a recipe'));
// fireEvent.click(screen.getByText('mock-recipe-1'));
fireEvent.click(screen.getByText('Recipe'));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't use fireEvent: use user-event instead.

Copy link
Collaborator

@alfonsomthd alfonsomthd Oct 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have n example of user-event usage here.

@SanjalKatiyar
Copy link
Collaborator

/approve
/lgtm

Copy link
Contributor

openshift-ci bot commented Oct 24, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: GowthamShanmugam, SanjalKatiyar

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [GowthamShanmugam,SanjalKatiyar]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 4bae5b0 into red-hat-storage:master Oct 24, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants