Skip to content

Commit ec3be25

Browse files
authored
Merge pull request #54413 from nextcloud/perf/render-sharing-tab-sections-only-once
perf: render sharing tab sections only once
2 parents 9dd661f + 798f373 commit ec3be25

File tree

11 files changed

+21
-10
lines changed

11 files changed

+21
-10
lines changed

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 to render a section in the sharing tab.
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: 6 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,6 +285,10 @@ 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: {
291294
/**

dist/6348-6348.js

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

dist/6348-6348.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/6348-6348.js.map.license

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

dist/7639-7639.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

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.

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.

0 commit comments

Comments
 (0)