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
fix: pass the copy of object to avoid modifying an original one #383
Conversation
@@ -107,6 +107,6 @@ function toggleRegistryModal(): void { | |||
<PreferencesRegistriesEditCreateRegistryModal | |||
toggleCallback="{toggleRegistryModal}" | |||
mode="{preferencesMode}" | |||
registry="{selectedRegistry}" /> | |||
registry="{{source: selectedRegistry?.source, serverUrl: selectedRegistry?.serverUrl, username: selectedRegistry?.username, secret: selectedRegistry?.secret}}" /> |
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.
will it work to use {...selectedRegistry}
?
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.
need to check
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.
approving but better if we can use spread syntax as we don't need to enumerate all fields
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.
yep, that works, updated the PR
1afb36f
to
5a74fa1
Compare
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.
if we can use spread operator would be better
2893b8d
to
df837ea
Compare
Signed-off-by: Vladyslav Zhukovskyi <vzhukovs@redhat.com>
ba7d5eb
to
643d45e
Compare
What does this PR do?
Do not modify the original registry object instance, when the dialog opens. This prevents the original object instance from the modification, when user closes the dialog without create or update action.
Signed-off-by: Vladyslav Zhukovskyi vzhukovs@redhat.com
Screenshot/screencast of this PR
N/A
What issues does this PR fix or reference?
part of #290
How to test this PR?
Open dialog to modify the existed registry, type any values and close the dialog, then open the dialog again. Values should not be modified.