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

Force rerender on update/save #4396

Merged
merged 5 commits into from
Jan 2, 2020
Merged

Force rerender on update/save #4396

merged 5 commits into from
Jan 2, 2020

Conversation

ludeeus
Copy link
Member

@ludeeus ludeeus commented Dec 29, 2019

Changes

  • Adds a disabled property to the save button if there are no changes.
  • Changes to property definitions to use @property().
  • Add styles to the disabled save button.

Closes #4391
This also fixes an issue where the "Saved" and "Unsaved changes" were not showing.

rerender

@@ -152,6 +155,9 @@ class LovelaceFullConfigEditor extends LitElement {
} else if (!this._changed && window.onbeforeunload) {
window.onbeforeunload = null;
}
if (this._changed) {
this.requestUpdate();
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need the requestUpdate?

Copy link
Member Author

Choose a reason for hiding this comment

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

When I tested this, that was the best I could come up with, that is now a few days ago, I can probably do something different now to handle it, I'll have a look after work.

Copy link
Member

Choose a reason for hiding this comment

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

_changed is a property, so if that is updated it should re-render?

Copy link
Member Author

Choose a reason for hiding this comment

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

Should, yes.
does, not so much 🤷‍♂ (can be tested here https://demo.home-assistant.io/#/lovelace/0)

I can probably find a better way later today.

Copy link
Member Author

Choose a reason for hiding this comment

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

Found a better way, looking at styles now

@bramkragten
Copy link
Member

I think the disabled button needs a little styling, the text is very hard to read now.

@ludeeus
Copy link
Member Author

ludeeus commented Jan 2, 2020

save
with some style changes.

@bramkragten bramkragten merged commit 70b81de into home-assistant:dev Jan 2, 2020
@ludeeus ludeeus deleted the lovelace-editor-rerender branch January 2, 2020 20:16
@bramkragten bramkragten mentioned this pull request Jan 7, 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.

Better visual feedback for save button in Raw Config Editor
3 participants