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

Bug 1910483: Fix for Storage cluster creation failed with 'Cannot read property "protocol" of null ' on adding& then cancelling Encryption #7688

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,17 @@ export const EncryptionFormGroup: React.FC<EncryptionFormGroupProps> = ({
}, [encryption.clusterWide, encryption.storageClass, encryptionChecked]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@afreen23 I can see a separate useEffect is to set "hasHandled" flag for all cases, Setting a flag is kind of redundant and leads to unpredicted behavior, so I removed it from my latest change


const toggleEncryption = (checked: boolean) => {
setEncryptionDispatch(ActionType.SET_ENCRYPTION, mode, dispatch, {
const payload = {
...encryption,
clusterWide: checked,
});
setEncryptionChecked(checked);
};
if (!checked) {
payload.advanced = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

We should also set all encryption level and both encryption and kms states to initial value when the high level encryption box is unchecked.
This is to ensure that stale states dont cause errors,

      payload.advanced = false;
      payload.storageClass = false;
      payload.hasHandled = false;

There is already one check for clearing kms state on L88, please merge the above with this one.

if (!checked) {
setEncryptionDispatch(ActionType.CLEAR_KMS_STATE, mode, dispatch);
}
};

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

payload.storageClass = false;
setEncryptionDispatch(ActionType.CLEAR_KMS_STATE, mode, dispatch);
}
setEncryptionDispatch(ActionType.SET_ENCRYPTION, mode, dispatch, payload);
setEncryptionChecked(checked);
};

const toggleClusterWideEncryption = (checked: boolean) => {
Expand Down