Misc memory leak fixes (#7224)

* fix(leak): remove font listeners

* fix(leak): release componentInstance

* fix(perf): remove unused emit

* fix(perf): only emit if tickWidth changes

* fix: warnings and undefined keys

* fix: remove unused bind

* fix: restore MctTicks component
This commit is contained in:
Jesse Mazzella 2024-02-14 15:49:02 -08:00 committed by GitHub
parent a9ad0bf38a
commit e08633214e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 30 additions and 21 deletions

View File

@ -79,5 +79,6 @@ export default class LADTableView {
if (this._destroy) { if (this._destroy) {
this._destroy(); this._destroy();
} }
this.component = null;
} }
} }

View File

@ -85,6 +85,7 @@ export default class ConditionSetViewProvider {
if (_destroy) { if (_destroy) {
_destroy(); _destroy();
} }
component = null;
} }
}; };
} }

View File

@ -99,7 +99,7 @@ class DisplayLayoutView {
destroy() { destroy() {
if (this._destroy) { if (this._destroy) {
this._destroy(); this._destroy();
this.component = undefined; this.component = null;
} }
} }
} }

View File

@ -53,13 +53,13 @@
></span> ></span>
</div> </div>
<mct-ticks <MctTicks
v-show="gridLines && !options.compact" v-show="gridLines && !options.compact"
:axis-type="'xAxis'" :axis-type="'xAxis'"
:position="'right'" :position="'right'"
/> />
<mct-ticks <MctTicks
v-for="(yAxis, index) in yAxesIds" v-for="(yAxis, index) in yAxesIds"
v-show="gridLines" v-show="gridLines"
:key="`yAxis-gridlines-${index}`" :key="`yAxis-gridlines-${index}`"

View File

@ -273,12 +273,14 @@ export default {
) )
); );
this.tickWidth = tickWidth; if (this.tickWidth !== tickWidth) {
this.$emit('plot-tick-width', { this.tickWidth = tickWidth;
width: tickWidth, this.$emit('plot-tick-width', {
yAxisId: this.axisType === 'yAxis' ? this.axisId : '' width: tickWidth,
}); yAxisId: this.axisType === 'yAxis' ? this.axisId : ''
this.shouldCheckWidth = false; });
this.shouldCheckWidth = false;
}
} }
} }

View File

@ -22,7 +22,7 @@
<template> <template>
<div v-if="loaded" class="gl-plot-axis-area gl-plot-x has-local-controls"> <div v-if="loaded" class="gl-plot-axis-area gl-plot-x has-local-controls">
<mct-ticks :axis-type="'xAxis'" :position="'left'" @plot-tick-width="onTickWidthChange" /> <MctTicks :axis-type="'xAxis'" :position="'left'" />
<div class="gl-plot-label gl-plot-x-label" :class="{ 'icon-gear': isEnabledXKeyToggle() }"> <div class="gl-plot-label gl-plot-x-label" :class="{ 'icon-gear': isEnabledXKeyToggle() }">
{{ xAxisLabel }} {{ xAxisLabel }}
@ -59,7 +59,6 @@ export default {
} }
} }
}, },
emits: ['plot-x-tick-width'],
data() { data() {
return { return {
selectedXKeyOptionKey: '', selectedXKeyOptionKey: '',
@ -137,9 +136,6 @@ export default {
this.xAxisLabel = this.xAxis.get('label'); this.xAxisLabel = this.xAxis.get('label');
this.selectedXKeyOptionKey = this.selectedXKeyOptionKey =
this.xKeyOptions.length > 0 ? this.getXKeyOption(xAxisKey).key : xAxisKey; this.xKeyOptions.length > 0 ? this.getXKeyOption(xAxisKey).key : xAxisKey;
},
onTickWidthChange(width) {
this.$emit('plot-x-tick-width', width);
} }
} }
}; };

View File

@ -60,7 +60,7 @@
</option> </option>
</select> </select>
<mct-ticks <MctTicks
:axis-id="id" :axis-id="id"
:axis-type="'yAxis'" :axis-type="'yAxis'"
class="gl-plot-ticks" class="gl-plot-ticks"

View File

@ -23,7 +23,7 @@
<div v-if="loaded" class="js-plot-options-browse"> <div v-if="loaded" class="js-plot-options-browse">
<ul v-if="!isStackedPlotObject" class="c-tree" aria-label="Plot Series Properties"> <ul v-if="!isStackedPlotObject" class="c-tree" aria-label="Plot Series Properties">
<h2 class="--first" title="Plot series display properties in this object">Plot Series</h2> <h2 class="--first" title="Plot series display properties in this object">Plot Series</h2>
<plot-options-item v-for="series in plotSeries" :key="series.key" :series="series" /> <PlotOptionsItem v-for="series in plotSeries" :key="series.keyString" :series="series" />
</ul> </ul>
<div v-if="plotSeries.length && !isStackedPlotObject" class="grid-properties"> <div v-if="plotSeries.length && !isStackedPlotObject" class="grid-properties">
<ul <ul

View File

@ -23,7 +23,7 @@
<div v-if="loaded" class="js-plot-options-edit"> <div v-if="loaded" class="js-plot-options-edit">
<ul v-if="!isStackedPlotObject" class="c-tree" aria-label="Plot Series Properties"> <ul v-if="!isStackedPlotObject" class="c-tree" aria-label="Plot Series Properties">
<h2 class="--first" title="Display properties for this object">Plot Series</h2> <h2 class="--first" title="Display properties for this object">Plot Series</h2>
<li v-for="series in plotSeries" :key="series.key"> <li v-for="series in plotSeries" :key="series.keyString">
<series-form :series="series" @series-updated="updateSeriesConfigForObject" /> <series-form :series="series" @series-updated="updateSeriesConfigForObject" />
</li> </li>
</ul> </ul>

View File

@ -184,7 +184,7 @@ export default {
return this.series.get('color').asHexString(); return this.series.get('color').asHexString();
} }
}, },
mounted() { created() {
this.status = this.openmct.status.get(this.series.domainObject.identifier); this.status = this.openmct.status.get(this.series.domainObject.identifier);
this.removeStatusListener = this.openmct.status.observe( this.removeStatusListener = this.openmct.status.observe(
this.series.domainObject.identifier, this.series.domainObject.identifier,

View File

@ -191,7 +191,7 @@ export default {
return this.series.get('color').asHexString(); return this.series.get('color').asHexString();
} }
}, },
mounted() { created() {
this.initialize(); this.initialize();
this.status = this.openmct.status.get(this.series.domainObject.identifier); this.status = this.openmct.status.get(this.series.domainObject.identifier);
@ -206,7 +206,7 @@ export default {
} }
}, },
methods: { methods: {
initialize: function () { initialize() {
this.fields = [ this.fields = [
{ {
modelProp: 'yKey', modelProp: 'yKey',

View File

@ -39,6 +39,10 @@ export default {
this.stopListeningStyles(); this.stopListeningStyles();
} }
if (this.stopListeningFontStyles) {
this.stopListeningFontStyles();
}
if (this.styleRuleManager) { if (this.styleRuleManager) {
this.styleRuleManager.destroy(); this.styleRuleManager.destroy();
} }

View File

@ -82,6 +82,7 @@ export default class Tabs {
if (this.destroy) { if (this.destroy) {
this.destroy(); this.destroy();
} }
component = null;
} }
}; };
} }

View File

@ -63,6 +63,7 @@ export default class TelemetryTableView {
if (this._destroy) { if (this._destroy) {
this._destroy(); this._destroy();
} }
this.component = null;
} }
show(element, editMode, { renderWhenVisible }) { show(element, editMode, { renderWhenVisible }) {

View File

@ -99,7 +99,10 @@ export default class ViewLargeAction {
} }
); );
this.preview = vNode.componentInstance; this.preview = vNode.componentInstance;
this.destroy = destroy; this.destroy = () => {
destroy();
this.preview = null;
};
return this.preview.$el; return this.preview.$el;
} }