-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Loadpoint UI: improve title visibility #26248
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
base: master
Are you sure you want to change the base?
Conversation
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.
Hey - I've found 1 issue, and left some high level feedback:
- Consider disposing the
loadpointTitleTooltipinstance inunmounted(and possibly when the element stops overflowing) instead of only disabling it to avoid lingering tooltip state and potential memory leaks. - The global
resizeandorientationchangelisteners callupdateLoadpointToolTipon every event; adding a small debounce or throttle would reduce layout thrashing from repeatedscrollWidth/clientWidthmeasurements on rapid resize. - In
updateLoadpointToolTip, it may be safer to assert/guard thatthis.$refs.loadpointTitleis anHTMLElement(and not, for example, an array of elements) before accessing layout properties, to avoid runtime errors if the template changes.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider disposing the `loadpointTitleTooltip` instance in `unmounted` (and possibly when the element stops overflowing) instead of only disabling it to avoid lingering tooltip state and potential memory leaks.
- The global `resize` and `orientationchange` listeners call `updateLoadpointToolTip` on every event; adding a small debounce or throttle would reduce layout thrashing from repeated `scrollWidth/clientWidth` measurements on rapid resize.
- In `updateLoadpointToolTip`, it may be safer to assert/guard that `this.$refs.loadpointTitle` is an `HTMLElement` (and not, for example, an array of elements) before accessing layout properties, to avoid runtime errors if the template changes.
## Individual Comments
### Comment 1
<location> `assets/js/components/Loadpoints/Loadpoint.vue:343-349` </location>
<code_context>
+ window.addEventListener("orientationchange", this.updateLoadpointToolTip);
+ this.updateLoadpointToolTip();
},
unmounted() {
if (this.tickerHandler) {
clearInterval(this.tickerHandler);
}
+ window.removeEventListener("resize", this.updateLoadpointToolTip);
+ window.removeEventListener("orientationchange", this.updateLoadpointToolTip);
},
methods: {
</code_context>
<issue_to_address>
**suggestion (performance):** Dispose the Bootstrap tooltip instance on unmount to avoid potential leaks and dangling event listeners.
In `unmounted`, you clean up the window listeners but keep the Bootstrap `Tooltip` instance. Since tooltips attach their own listeners and references, also call `this.loadpointTitleTooltip?.dispose()` (and optionally set `this.loadpointTitleTooltip = null`) to fully release resources.
```suggestion
unmounted() {
if (this.tickerHandler) {
clearInterval(this.tickerHandler);
}
// Dispose Bootstrap tooltip instance to avoid leaks and dangling listeners
this.loadpointTitleTooltip?.dispose();
this.loadpointTitleTooltip = null;
window.removeEventListener("resize", this.updateLoadpointToolTip);
window.removeEventListener("orientationchange", this.updateLoadpointToolTip);
},
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
@Maschga Lets not do the tooltip. This is a user-controlled field. Nothing unexpected should be here the would require this. We dont have a reliable (non-complex) way of only showing the tooltip if needed (css layouting). Tooltips generally work sub-optimal on mobile devices. |
I added the tooltip because the user has no way of reading the complete loadpoint title if it has been truncated. |
I'm happy to put in a little extra effort for this, because I now have one of these things hanging on my wall myself. :D |

Fix #26212
📝 show loadpoint in two row style in lg breakpoint range (extracted from #20499)
\cc @naltatis