Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Fix DownloadImageModal submit button being disabled when switching from a device type that has wifi network capability to one that does not#1621

Open
myarmolinsky wants to merge 1 commit intomasterfrom
fix-download-image-modal-submit-disabled-when-switching-btn-dts-with-diff-options
Open

Fix DownloadImageModal submit button being disabled when switching from a device type that has wifi network capability to one that does not#1621
myarmolinsky wants to merge 1 commit intomasterfrom
fix-download-image-modal-submit-disabled-when-switching-btn-dts-with-diff-options

Conversation

@myarmolinsky
Copy link
Copy Markdown
Contributor

@myarmolinsky myarmolinsky commented Jul 14, 2022

Fix DownloadImageModal submit button being disabled when switching from a device type that has wifi network capability to one that does not

Change-type: patch
Signed-off-by: Matthew Yarmolinsky matthew-timothy@balena.io


Contributor checklist
  • I have regenerated jest snapshots for any affected components with npm run generate-snapshots
Reviewer Guidelines
  • When submitting a review, please pick:
    • 'Approve' if this change would be acceptable in the codebase (even if there are minor or cosmetic tweaks that could be improved).
    • 'Request Changes' if this change would not be acceptable in our codebase (e.g. bugs, changes that will make development harder in future, security/performance issues, etc).
    • 'Comment' if you don't feel you have enough information to decide either way (e.g. if you have major questions, or you don't understand the context of the change sufficiently to fully review yourself, but want to make a comment)

@myarmolinsky myarmolinsky requested review from pipex and thgreasi July 14, 2022 17:27
@myarmolinsky myarmolinsky self-assigned this Jul 14, 2022

return formModel.network === 'wifi' && !formModel.wifiSsid;
if (
(deviceType.options?.filter((option) => option.name === 'network') ?? [])
Copy link
Copy Markdown
Contributor

@thgreasi thgreasi Jul 15, 2022

Choose a reason for hiding this comment

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

Could we instead try to clear the state properties that are not in the options any more?
Then the title would become:

DownloadImageModal: Fix disabling submit when switching between DTs that have different options

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If we clear the state properties of options that are not there anymore, that means we will also lose the input the user stored for wifi credentials when they go from wifi -> no wifi -> wifi (currently if I enter a network and password, then switch to a DT with no wifi, then switch back to a DT with wifi, the network and password I entered remain). All of this data on the model state. So we cannot just clear all state that is not relevant to the current DT because then if the user switches back and forth between DTs, we would be inconveniencing them by making them re-enter all the data they entered priorly. Perhaps we don't want the data persisting anyway though, what do you think about it all? @thgreasi

@myarmolinsky myarmolinsky requested a review from thgreasi July 18, 2022 11:49
…om a device type that has wifi network capability to one that does not

Change-type: patch
Signed-off-by: Matthew Yarmolinsky <matthew-timothy@balena.io>
@myarmolinsky myarmolinsky force-pushed the fix-download-image-modal-submit-disabled-when-switching-btn-dts-with-diff-options branch from 083d5f7 to 1efba33 Compare July 28, 2022 14:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants