-
-
Notifications
You must be signed in to change notification settings - Fork 428
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
Update semantic metadata of group members when groups are added/removed #2884
Conversation
This fixes the issue that the semantic metadata is incorrect when defining items in files and groups in the UI. Fixes openhab#2117 Signed-off-by: Wouter Born <github@maindrain.net>
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/file-based-items-and-ui-defined-groups-not-playing-nicely/134609/21 |
Maybe you have some time to review this small bugfix so it makes it into the next milestone @openhab/core-maintainers? |
@@ -82,10 +82,10 @@ public SemanticsMetadataProvider(final @Reference ItemRegistry itemRegistry) { | |||
@Activate | |||
protected void activate() { | |||
initRelations(); | |||
itemRegistry.addRegistryChangeListener(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is moving this line up here really needed? Listening to changes should happen only after the initial item set is processed and it should be made sure that those calls only come in once the service is activated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved it because without this change there is a chance that it will not receive changes when the thread gets suspended while processing all the items.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Iirc, we are using this pattern at many places.
To be really clean, we should then have a marker that the component is not yet activated and queue the listener changes to have them processed at a later moment. Because otherwise, it could also happen that you process a change before the activate method processed its older state. That would make the overall code pretty complex, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've moved it back. Let's fix this when it really becomes an issue. 😉
Signed-off-by: Wouter Born <github@maindrain.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks!
…ed (openhab#2884) * Update semantic metadata of group members when groups are added/removed This fixes the issue that the semantic metadata is incorrect when defining items in files and groups in the UI. Fixes openhab#2117 GitOrigin-RevId: b5de891
This fixes the issue that the semantic metadata is incorrect when defining group member items in files and their groups in the UI.
Fixes #2106
Fixes #2117