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

Refresh frontend on start event #6042

Closed
wants to merge 1 commit into from

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented May 25, 2020

Proposed change

Refresh the frontend when Home Assistant fires the start event.

This PR supports home-assistant/core#36093 (review)

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

Example configuration

Additional information

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

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

@bramkragten
Copy link
Member

Although this probably fixes the issues with the early startup of the frontend, I don't think this is the way to go.

If startup took a long time we now just refresh the page when a user was maybe in the middle of editing something.

I rather fix the issues I mentioned in your PR, the first thing we will need for that is a flag so the frontend knows HA is not done starting yet.

@bdraco
Copy link
Member Author

bdraco commented May 25, 2020

I rather fix the issues I mentioned in your PR, the first thing we will need for that is a flag so the frontend knows HA is not done starting yet.

How should we tell the the frontend that HA isn't starting yet?

I'm poking around in the dark a bit with the frontend so it may be far less frustrating for everyone if I'm not the one making the changes on this side of the house.

@bramkragten
Copy link
Member

I'm completely fine with making the changes on this side :-)

We could add a started boolean to hass.config?

@bdraco
Copy link
Member Author

bdraco commented May 25, 2020

I'm completely fine with making the changes on this side :-)
TYVM 🥇

We could add a started boolean to hass.config?

I added hass.config.start_complete. I didn't use started as I didn't want to confuse it with EVENT_HOMEASSISTANT_STARTED

// when startup is completed
conn.subscribeEvents(() => {
location.reload();
}, "homeassistant_start");
Copy link
Member

Choose a reason for hiding this comment

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

This is too aggressive. Most pages will actually do just fine. It's just generated Lovelace UIs opened while starting up that have issues.

Copy link
Member

Choose a reason for hiding this comment

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

We also shouldn't add non-data logic in the state mix-ins as they are used for other projects too (ie cast). We have logic like this in home-assistant.ts for when we detect a version upgrade (And a reload is needed)

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed. Probably makes sense to close this PR and go the route @bramkragten suggested above in #6042 (comment)

I'll leave this open and marked as a draft for now though so there is a place to comment.

@bdraco bdraco marked this pull request as draft May 25, 2020 16:52
@bdraco
Copy link
Member Author

bdraco commented May 28, 2020

This work has been superseded by a better solution in #6068

@bdraco bdraco closed this May 28, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jul 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HTTP fails to start if cameras cannot be setup
4 participants