Fix config flow: button text and error message#3
Closed
marcinbauer-ohf wants to merge 2 commits intodevfrom
Closed
Fix config flow: button text and error message#3marcinbauer-ohf wants to merge 2 commits intodevfrom
marcinbauer-ohf wants to merge 2 commits intodevfrom
Conversation
Clearing the area picker still added the device to `_deviceUpdate` with an empty area, making `Object.keys(_deviceUpdate).length` truthy and showing "Finish" instead of "Skip and finish". Fix checks for meaningful updates (non-empty name or area) instead of mere presence of entries in the update map. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
`handleFetchPromise` throws `{ error, body, status_code }` — not a
standard Error instance — so `err.message` is always undefined. The
error handler only checked `err.message || err.body`, missing `err.error`
entirely, causing every network-level failure to show "Unknown error".
Also extract `err.body.message` when the body is a JSON object rather
than JSON-stringifying the whole object.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
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.
Proposed change
Two bug fixes in the config flow dialog:
1. "Skip and finish" button text when area picker is cleared
Clearing the area picker still added the device to
_deviceUpdatewith an empty area value, makingObject.keys(_deviceUpdate).lengthtruthy. This caused the button to show "Finish" instead of "Skip and finish" even when no area was selected.Fix checks for meaningful updates (non-empty name or area) using
.some()instead of just checking for entry presence.2. Config flow error showing "Unknown error" instead of actual message
handleFetchPromisethrows a plain object{ error, body, status_code }, not a standardErrorinstance, soerr.messageis alwaysundefined. The error handler only checkederr.message || err.body, missingerr.errorentirely. Every network-level failure (connection refused, CORS, etc.) showed "Unknown error".Fix checks in priority order:
err.message→err.body.message(when body is a JSON object) →err.body→err.error→"Unknown error".Screenshots
No visual changes (button text fix is behavioral, error message fix only affects error dialogs).
Type of change
Additional information
Checklist
To help with the load of incoming pull requests: