Fixes an issue with array based fields when saving from the web UI#49
Merged
infinition merged 2 commits intoNov 19, 2024
Merged
Conversation
Closed
Contributor
Author
|
Also added a 2nd commit that will handle the case where a user wants to clear out a value, that otherwise would've came in as The web behavior will now return early if the user input form data is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes a potential issue when a user clicks "Save" from the web UI and can null out empty array fields or even change types (ie: Array to String).
In my case I had only a single
mac_scan_blacklistvalue, the mac address of the Bjorn device itself. When the UI presented this valuexx:xx:xx:xxit did not include a,character and was being skipped by the checkvalue.includes(',')inconfig.js.The code now tracks known array fields and will either test if the value includes a
,or if the form field is a known array type. This will allow the array based form fields to hit the same logic path and keep the data type accurate and consistent.I could verify this change by grepping the
shared_config.jsonand watching the "Save" turn the config into this:Then after the code fix