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

Fix translation loading and manifest fetching for integration page #21501

Merged
merged 2 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/layouts/hass-tabs-subpage-data-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ export class HaTabsSubpageDataTable extends LitElement {
<ha-assist-chip
.label=${localize("ui.components.subpage-data-table.sort_by", {
sortColumn: this._sortColumn
? ` ${this.columns[this._sortColumn].title || this.columns[this._sortColumn].label}`
? ` ${this.columns[this._sortColumn]?.title || this.columns[this._sortColumn]?.label}` ||
""
: "",
})}
id="sort-by-anchor"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,11 @@ class HaConfigIntegrationsDashboard extends SubscribeMixin(LitElement) {
this.configEntriesInProgress.map((flow) => flow.handler)
);
}
if (changed.has("configEntries") && this.configEntries) {
this._fetchIntegrationManifests(
this.configEntries.map((entry) => entry.domain)
);
}
Comment on lines +318 to +322
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure proper error handling for _fetchIntegrationManifests.

While the logic to fetch integration manifests when configEntries changes is correct, consider adding error handling to manage potential issues during the fetch operation.

if (changed.has("configEntries") && this.configEntries) {
  try {
    this._fetchIntegrationManifests(
      this.configEntries.map((entry) => entry.domain)
    );
  } catch (error) {
    console.error("Failed to fetch integration manifests:", error);
  }
}

}

protected render() {
Expand Down
5 changes: 4 additions & 1 deletion src/panels/config/integrations/ha-config-integrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@ class HaConfigIntegrations extends SubscribeMixin(HassRouterPage) {
if (this.hasUpdated) {
return;
}
this._loadTranslationsPromise = this.hass.loadBackendTranslation("title");
this._loadTranslationsPromise = this.hass.loadBackendTranslation(
"title",
this.hass.config.components.map((comp) => comp.split(".")[0])
);
}

protected updatePageEl(pageEl) {
Expand Down
2 changes: 1 addition & 1 deletion src/panels/config/integrations/ha-integration-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export class HaIntegrationCard extends LitElement {
>
</div>`
: nothing}
${!this.manifest?.config_flow
${this.manifest && !this.manifest?.config_flow
? html`<div class="icon yaml">
<ha-svg-icon .path=${mdiCodeBraces}></ha-svg-icon>
<simple-tooltip
Expand Down
Loading