Skip to content

Commit 9d5819b

Browse files
committed
perf: render sharing tab sections only once
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
1 parent 2979a2b commit 9d5819b

10 files changed

Lines changed: 22 additions & 10 deletions

apps/files_sharing/src/services/TabSections.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

6+
/**
7+
* Callback for adding two numbers.
8+
*
9+
* @callback registerSectionCallback
10+
* @param {undefined} el - Deprecated and will always be undefined (formerly the root element)
11+
* @param {object} fileInfo - File info object
12+
*/
13+
614
export default class TabSections {
715

816
_sections

apps/files_sharing/src/views/SharingTab.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,10 @@
127127
</NcPopover>
128128
</div>
129129
<!-- additional entries, use it with cautious -->
130-
<div v-for="(section, index) in sections"
131-
:ref="'section-' + index"
130+
<div v-for="(component, index) in sectionComponents"
132131
:key="index"
133132
class="sharingTab__additionalContent">
134-
<component :is="section($refs['section-'+index], fileInfo)" :file-info="fileInfo" />
133+
<component :is="component" :file-info="fileInfo" />
135134
</div>
136135

137136
<!-- projects (deprecated as of NC25 (replaced by related_resources) - see instance config "projects.enabled" ; ignore this / remove it / move into own section) -->
@@ -286,8 +285,13 @@ export default {
286285
// TRANSLATORS: Type as in with a keyboard
287286
: t('files_sharing', 'Type an email or federated cloud ID')
288287
},
288+
289+
sectionComponents() {
290+
return this.sections.map((section) => section(undefined, this.fileInfo))
291+
},
289292
},
290293
methods: {
294+
291295
/**
292296
* Update current fileInfo and fetch new data
293297
*

dist/7639-7639.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/7639-7639.js.map.license

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/9949-9949.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/9949-9949.js.map.license

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9949-9949.js.license

dist/files_sharing-files_sharing_tab.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files_sharing-files_sharing_tab.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)