From 90974b6c1ed3854390c0f442b65bf510114cfbbb Mon Sep 17 00:00:00 2001 From: ludeeus Date: Mon, 1 Jan 2024 20:41:45 +0000 Subject: [PATCH] Move "repository" dispatch message --- custom_components/hacs/base.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/custom_components/hacs/base.py b/custom_components/hacs/base.py index 28816999fb3..210c41db774 100644 --- a/custom_components/hacs/base.py +++ b/custom_components/hacs/base.py @@ -599,7 +599,7 @@ async def async_register_repository( repository.data.id = repository_id else: - if self.hass is not None and ((check and repository.data.new) or self.status.new): + if self.hass is not None and check and repository.data.new: self.async_dispatch( HacsDispatchEvent.REPOSITORY, { @@ -887,15 +887,6 @@ async def async_get_category_repositories_experimental(self, category: str) -> N repository.repository_manifest.update_data( {**dict(HACS_MANIFEST_KEYS_TO_EXPORT), **manifest} ) - self.async_dispatch( - HacsDispatchEvent.REPOSITORY, - { - "id": 1337, - "action": "update", - "repository": repository.data.full_name, - "repository_id": repository.data.id, - }, - ) if category == "integration": self.status.inital_fetch_done = True @@ -912,6 +903,16 @@ async def async_get_category_repositories_experimental(self, category: str) -> N ) self.repositories.unregister(repository) + self.async_dispatch( + HacsDispatchEvent.REPOSITORY, + { + "id": 1337, + "action": "update", + "repository": repository.data.full_name, + "repository_id": repository.data.id, + }, + ) + async def async_get_category_repositories(self, category: HacsCategory) -> None: """Get repositories from category.""" if self.system.disabled: