Repository navigation
Conversation
When a plugin is already registered in frontend extra_module_url under /hacsfiles/<name>/ or /local/community/<name>/, do not create a new dashboard resource for it on install or update. The module would otherwise load twice, because the two URLs differ, and the resource comes back on every update after the user deletes it. Existing resources are still updated as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed change
Some plugins are meant to be loaded through
frontend: extra_module_urlinstead of, or before, dashboard resources. custom-brand-icons is one example: its icons are also used outside dashboards, so the user adds it toextra_module_url.When such a plugin is installed or updated,
update_dashboard_resourcesfinds no entry under/hacsfiles/<name>/and creates one. The user can delete it, but it comes back on the next update. The module then loads twice on every page, because ES modules are keyed by URL and the two URLs differ (/local/community/<name>/...vs/hacsfiles/<name>/...?hacstag=...). For custom-brand-icons that is 4.7 MB of JavaScript fetched and evaluated twice. Google Cast receivers only read dashboard resources, so they fetch it as well even when the cast dashboard does not use it.With this change,
update_dashboard_resourcesdoes not create a new resource when the plugin is already registered inextra_module_urlunder/hacsfiles/<name>/or/local/community/<name>/. It reads the list throughhass.data[DATA_EXTRA_MODULE_URL], the same registry thatadd_extra_js_url(already used by HACS foriconset.js) writes to.What does not change:
hacstagas before. A user who keeps both registrations, for example to keep a plugin available on Cast, sees no difference.extra_module_urlbehave exactly as before.hacs.jsonkey, so plugin authors and users have nothing to configure.Related: #5516, which proposes the opposite direction (letting plugins opt into
extra_module_urlregistration). The two changes do not conflict.Tests added:
extra_module_urlpoints at the plugin under/hacsfiles/<name>/, or under/local/community/<name>/;extra_module_urlpoints at another plugin whose name shares a prefix (plugin-basic-extra).Type of change
Checklist
🤖 Generated with Claude Code