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

fix: pass the copy of object to avoid modifying an original one #383

Merged
merged 1 commit into from Aug 9, 2022

Conversation

vzhukovs
Copy link
Contributor

@vzhukovs vzhukovs commented Aug 8, 2022

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.

@vzhukovs vzhukovs requested a review from benoitf as a code owner August 8, 2022 16:03
@vzhukovs vzhukovs self-assigned this Aug 8, 2022
@@ -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}}" />
Copy link
Collaborator

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} ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

need to check

Copy link
Collaborator

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

Copy link
Contributor Author

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

Copy link
Collaborator

@benoitf benoitf left a 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

Signed-off-by: Vladyslav Zhukovskyi <vzhukovs@redhat.com>
@benoitf benoitf changed the title fix: pass the copy of opbject to avoid modyfing an original one fix: pass the copy of opbject to avoid modifying an original one Aug 8, 2022
@vzhukovs vzhukovs merged commit 7c28cbd into main Aug 9, 2022
@vzhukovs vzhukovs deleted the dialog-options branch August 9, 2022 07:30
@benoitf benoitf changed the title fix: pass the copy of opbject to avoid modifying an original one fix: pass the copy of object to avoid modifying an original one Aug 9, 2022
@podman-desktop-bot podman-desktop-bot added this to the 0.0.6 milestone Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants