Skip to content

Improve UX for statistics data correction by streamlining dialog flows#30162

Open
a-bit-of-coding wants to merge 9 commits intohome-assistant:devfrom
a-bit-of-coding:improve-dialog-box-statistic-value-edit
Open

Improve UX for statistics data correction by streamlining dialog flows#30162
a-bit-of-coding wants to merge 9 commits intohome-assistant:devfrom
a-bit-of-coding:improve-dialog-box-statistic-value-edit

Conversation

@a-bit-of-coding
Copy link

Currently, correcting multiple sequential data points in the developer tools is tedious because the edit dialog closes entirely after each individual adjustment. This requires the user to re-open the dialog and re-select the date and time for every single entry, leading to a high amount of redundant clicks.

Proposed change

This PR refactors the interaction logic of the statistics correction dialogs to improve usability for bulk edits:

  • Persisting State: The dialog flow is adjusted so that the date picker and input fields remain accessible or reset in a more logical sequence, reducing the clicks needed for consecutive fixes.
  • Dialog Behavior: Refined the open/close triggers to prevent accidental closing while navigating between time steps.
  • Code Integrity: The underlying logic for data saving and variable cleanup has been preserved to ensure no memory leaks or stale data remain when the dialog is finally dismissed.

Screenshots

before:
simplescreenrecorder-2026-03-16_08 46 13-ezgif com-video-to-gif-converter

after:
simplescreenrecorder-2026-03-16_07 41 31-ezgif com-video-to-gif-converter

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue or discussion:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to backend pull request:

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

To help with the load of incoming pull requests:

home-assistant[bot]

This comment was marked as resolved.

@home-assistant home-assistant bot marked this pull request as draft March 16, 2026 07:53
@home-assistant

This comment was marked as resolved.

Streamline the process of fixing multiple values by improving the open/close behavior of date pickers and input dialogs.
@a-bit-of-coding a-bit-of-coding force-pushed the improve-dialog-box-statistic-value-edit branch from 31d85ef to cb7f7f4 Compare March 16, 2026 08:02
home-assistant[bot]

This comment was marked as resolved.

@a-bit-of-coding a-bit-of-coding marked this pull request as ready for review March 16, 2026 08:29
@home-assistant home-assistant bot dismissed stale reviews from themself March 16, 2026 08:29

Stale

@karwosts
Copy link
Member

Would it be better if we just didn't close the datapoint selection dialog after a data edit?

@a-bit-of-coding
Copy link
Author

a-bit-of-coding commented Mar 16, 2026

Would it be better if we just didn't close the datapoint selection dialog after a data edit?

I would prefer to keep the current behavior (closing the input dialog). In my opinion, it aligns better with the established UI patterns in "Development Statistic Edit" in Home Assistant, where the input dialog usually closes after submission. Changing this might confuse users who expect the task to be finished. Additionally, keeping it open would actually increase the total number of clicks for users who want to edit a multiple datapoints.

@karwosts
Copy link
Member

I'm fine if we do still want to close both dialogs when the 2nd dialog submits, but I am just genuinely curious how you think the suggestion would "increase clicks to edit multiple datapoints". It seems like to me it is less.

@a-bit-of-coding
Copy link
Author

I'm fine if we do still want to close both dialogs when the 2nd dialog submits, but I am just genuinely curious how you think the suggestion would "increase clicks to edit multiple datapoints". It seems like to me it is less.

Sorry. I thought you mean the Input Dialog.
I tried some constellations out in the source code, to not change the parameters destruction functions. And after closing the input dialog, it is necessary to reload the picker dialog. So it was a little bit tricky to keep the existing function as it is and handle the input dialog better and reload changed values to the picker dialog. Otherwise the picker dialog would have the old values.

@home-assistant home-assistant bot marked this pull request as draft March 16, 2026 16:01
Copy link

@home-assistant home-assistant bot left a comment

Choose a reason for hiding this comment

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

Hi @distancerunner

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Developer Tools → Statistics “adjust sum” dialog behavior in the Home Assistant frontend, focusing on post-adjust flow and dialog actions.

Changes:

  • Adds a helper to reset the selected statistic and refresh displayed statistics after an adjustment.
  • Changes the footer Close button to close the dialog via a click handler instead of declarative data-dialog="close".
  • Ensures _busy is cleared after a successful sum adjustment.

You can also share your feedback on Copilot code review. Take the survey.

…avior

The method was renamed to _resetSelectionAndRefreshStatisticData because it clears the selection and fetches new data instead of closing a dialog.
@a-bit-of-coding a-bit-of-coding marked this pull request as ready for review March 23, 2026 06:11
@home-assistant home-assistant bot requested a review from MindFreeze March 23, 2026 06:11
Consolidates state management by using a finally block in _fixIssue.
Removed closeDialog method in favor of data-dialog="close".
Comment on lines -86 to -87
public closeDialog(): void {
this._open = false;
Copy link
Member

Choose a reason for hiding this comment

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

Why is closeDialog() removed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants