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

Ensure semantic model pages are built after tags are loaded #2066

Merged
merged 7 commits into from
Sep 16, 2023

Conversation

florian-h05
Copy link
Contributor

Fixes #2006.

With the attempt in #2029 failing due to #2054, this finally fixes an issue where the semantic model pages (Equipment, Properties) were missing translations.
This was due to a race condition, where the semantic model pages were built before the tags were loaded.

This PR fixes this by watching for semantic model updates (i.e. subscripting to the underlying Vuex mutation) and loading/building the model pages after such an update.

Futher improvements:

  • Initial loading of semantic tags is put in parallel with other API requests performed on app init.
  • Vuex semantics: A mutation is used for setting the semantic tags from the action.
  • Debug logging is added to both the semantic tag and the semantic model page loading.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
@florian-h05 florian-h05 requested a review from a team as a code owner September 14, 2023 16:24
@@ -175,6 +174,12 @@ export default {
this.$store.dispatch('stopTrackingStates')
},
onPageInit () {
this.$store.subscribe((mutation, state) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ghys This could also be placed in homecards-mixin.js but it is only used by home.vue and home-edit.vue and I don't think we need this subscription for the edit page. I don`t think a user would want to update the semantic model tags and have the edit page open at the same time.

Do you agree?

Copy link
Member

Choose a reason for hiding this comment

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

Sure - makes sense.

@relativeci
Copy link

relativeci bot commented Sep 14, 2023

Job #1157: Bundle Size — 15.76MiB (~+0.01%).

9397bc5(current) vs 16ec4f1 main#1156(baseline)

⚠️ Bundle contains 16 duplicate packages

Metrics (1 change)
                 Current
Job #1157
     Baseline
Job #1156
Initial JS 1.67MiB(+0.03%) 1.67MiB
Initial CSS 608.89KiB 608.89KiB
Cache Invalidation 93.95% 93.95%
Chunks 219 219
Assets 689 689
Modules 1700 1700
Duplicate Modules 90 90
Duplicate Code 1.95% 1.95%
Packages 138 138
Duplicate Packages 15 15
Total size by type (2 changes)
                 Current
Job #1157
     Baseline
Job #1156
CSS 859.49KiB 859.49KiB
Fonts 526.1KiB 526.1KiB
HTML 1.23KiB 1.23KiB
IMG 140.74KiB 140.74KiB
JS 9.26MiB (~+0.01%) 9.25MiB
Media 295.6KiB 295.6KiB
Other 4.73MiB (~+0.01%) 4.73MiB

View job #1157 reportView main branch activity

Copy link
Member

@ghys ghys left a comment

Choose a reason for hiding this comment

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

Thanks for the investigation and the fix, nice to have some more debug logs too!

@ghys ghys merged commit f2c008b into openhab:main Sep 16, 2023
4 checks passed
@ghys ghys added bug Something isn't working main ui Main UI labels Sep 16, 2023
@ghys ghys added this to the 4.1 milestone Sep 16, 2023
@florian-h05 florian-h05 deleted the semantic-homepages-fix branch September 16, 2023 14:53
@florian-h05
Copy link
Contributor Author

One thing that came to my mind just a few seconds ago and that we have to keep an eye on, is that in case the home page is destroyed and re-created, the model won‘t load. I made it to only load when the tags are saved, because otherwise the model would be loaded two times on app init.

@florian-h05
Copy link
Contributor Author

florian-h05 commented Sep 18, 2023

I have thought about this again, and this cannot happen, since the model is loaded onPageAfterIn, so I will backport this then. The backport also needs #2029 and #2054.

@florian-h05 florian-h05 added the patch A PR that has been cherry-picked to a patch release branch label Sep 18, 2023
florian-h05 added a commit that referenced this pull request Sep 18, 2023
Fixes #2006.

With the attempt in #2029 failing due to #2054, this finally fixes an
issue where the semantic model pages (Equipment, Properties) were
missing translations.
This was due to a race condition, where the semantic model pages were
built before the tags were loaded.

This PR fixes this by watching for semantic model updates (i.e.
subscripting to the underlying Vuex mutation) and loading/building the
model pages after such an update.

Futher improvements:
- Initial loading of semantic tags is put in parallel with other API
requests performed on app init.
- Vuex semantics: A mutation is used for setting the semantic tags from
the action.
- Debug logging is added to both the semantic tag and the semantic model
page loading.

---------

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
(cherry picked from commit f2c008b)
stefan-hoehn pushed a commit to stefan-hoehn/openhab-webui that referenced this pull request Sep 23, 2023
…2066)

Fixes openhab#2006.

With the attempt in openhab#2029 failing due to openhab#2054, this finally fixes an
issue where the semantic model pages (Equipment, Properties) were
missing translations.
This was due to a race condition, where the semantic model pages were
built before the tags were loaded.

This PR fixes this by watching for semantic model updates (i.e.
subscripting to the underlying Vuex mutation) and loading/building the
model pages after such an update.

Futher improvements:
- Initial loading of semantic tags is put in parallel with other API
requests performed on app init.
- Vuex semantics: A mutation is used for setting the semantic tags from
the action.
- Debug logging is added to both the semantic tag and the semantic model
page loading.

---------

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Stefan Höhn <mail@stefanhoehn.com>
JustinGeorgi pushed a commit to JustinGeorgi/openhab-webui that referenced this pull request Sep 24, 2023
…2066)

Fixes openhab#2006.

With the attempt in openhab#2029 failing due to openhab#2054, this finally fixes an
issue where the semantic model pages (Equipment, Properties) were
missing translations.
This was due to a race condition, where the semantic model pages were
built before the tags were loaded.

This PR fixes this by watching for semantic model updates (i.e.
subscripting to the underlying Vuex mutation) and loading/building the
model pages after such an update.

Futher improvements:
- Initial loading of semantic tags is put in parallel with other API
requests performed on app init.
- Vuex semantics: A mutation is used for setting the semantic tags from
the action.
- Debug logging is added to both the semantic tag and the semantic model
page loading.

---------

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: jgeorgi <justin.georgi@gmail.com>
JustinGeorgi pushed a commit to JustinGeorgi/openhab-webui that referenced this pull request Sep 24, 2023
…2066)

Fixes openhab#2006.

With the attempt in openhab#2029 failing due to openhab#2054, this finally fixes an
issue where the semantic model pages (Equipment, Properties) were
missing translations.
This was due to a race condition, where the semantic model pages were
built before the tags were loaded.

This PR fixes this by watching for semantic model updates (i.e.
subscripting to the underlying Vuex mutation) and loading/building the
model pages after such an update.

Futher improvements:
- Initial loading of semantic tags is put in parallel with other API
requests performed on app init.
- Vuex semantics: A mutation is used for setting the semantic tags from
the action.
- Debug logging is added to both the semantic tag and the semantic model
page loading.

---------

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: jgeorgi <justin.georgi@gmail.com>
digitaldan pushed a commit to digitaldan/openhab-webui that referenced this pull request Sep 24, 2023
…2066)

Fixes openhab#2006.

With the attempt in openhab#2029 failing due to openhab#2054, this finally fixes an
issue where the semantic model pages (Equipment, Properties) were
missing translations.
This was due to a race condition, where the semantic model pages were
built before the tags were loaded.

This PR fixes this by watching for semantic model updates (i.e.
subscripting to the underlying Vuex mutation) and loading/building the
model pages after such an update.

Futher improvements:
- Initial loading of semantic tags is put in parallel with other API
requests performed on app init.
- Vuex semantics: A mutation is used for setting the semantic tags from
the action.
- Debug logging is added to both the semantic tag and the semantic model
page loading.

---------

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working main ui Main UI patch A PR that has been cherry-picked to a patch release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Openhab 4 translation fallback in main Ui
2 participants