pat-contentbrowser: keep add-on components registered under the default key - #1637
Conversation
…default key The pattern registered its default SelectedItem component in init(), on every widget initialization, and @plone/registry overwrites silently. An add-on that registered its own component under the default key "pat-contentbrowser.SelectedItem" was therefore reset by the next content browser that initialized, so replacing the component site-wide only worked via a custom key plus the componentRegistryKeys pattern option. The default component is now only registered if nothing is registered under that key yet. An add-on registration wins no matter whether the add-on bundle initializes before or after the pattern.
Timing considerations: add-on component registration vs. pattern initializationThis is about whether an add-on registering a component in Short version: there is a theoretical timing window, but this PR neither widens nor narrows it. It is exactly the same window the custom-key mechanism already has today. The guard only changes which key the add-on wins under, not when the content browser looks the component up. Why the window exists — the sequence after
|
thet
left a comment
There was a problem hiding this comment.
LGTM! simple and fine fix for this problem.
|
/run-coredev-6.2-robottests |
The pattern registered its default SelectedItem component in init(), on every widget initialization, and @plone/registry overwrites silently. An add-on that registered its own component under the default key "pat-contentbrowser.SelectedItem" was therefore reset by the next content browser that initialized, so replacing the component site-wide only worked via a custom key plus the componentRegistryKeys pattern option.
The default component is now only registered if nothing is registered under that key yet. An add-on registration wins no matter whether the add-on bundle initializes before or after the pattern.