🚑 Fix section error in Firefox (#633)

This commit is contained in:
Alicia Sykes 2022-05-06 12:43:30 +01:00
parent af5a26b0da
commit 7165a9a913

View File

@ -177,18 +177,18 @@ export default {
},
/* If the sortBy attribute is specified, then return sorted data */
sortedItems() {
let { items } = this;
const items = [...this.items];
if (this.appConfig.disableSmartSort) return items;
if (this.sortOrder === 'alphabetical') {
this.sortAlphabetically(items);
return this.sortAlphabetically(items);
} else if (this.sortOrder === 'reverse-alphabetical') {
this.sortAlphabetically(items).reverse();
return this.sortAlphabetically(items).reverse();
} else if (this.sortOrder === 'most-used') {
items = this.sortByMostUsed(items);
return this.sortByMostUsed(items);
} else if (this.sortOrder === 'last-used') {
items = this.sortByLastUsed(items);
return this.sortByLastUsed(items);
} else if (this.sortOrder === 'random') {
items = this.sortRandomly(items);
return this.sortRandomly(items);
} else if (this.sortOrder && this.sortOrder !== 'default') {
ErrorHandler(`Unknown Sort order '${this.sortOrder}' under '${this.title}'`);
}
@ -291,13 +291,15 @@ export default {
/* Calculate width of section, used to dynamically set number of columns */
calculateSectionWidth() {
const secElem = this.$refs[this.sectionRef];
if (secElem) this.sectionWidth = secElem.$el.clientWidth;
if (secElem && secElem.$el.clientWidth) this.sectionWidth = secElem.$el.clientWidth;
},
},
mounted() {
// Set the section width, and recalculate when section resized
this.resizeObserver = new ResizeObserver(this.calculateSectionWidth)
.observe(this.$refs[this.sectionRef].$el);
if (this.$refs[this.sectionRef]) {
this.resizeObserver = new ResizeObserver(this.calculateSectionWidth)
.observe(this.$refs[this.sectionRef].$el);
}
},
beforeDestroy() {
// If resize observer set, and element still present, then de-register