Skip to content

Reduce load of files versions preview loading - #38905

Merged
artonge merged 4 commits into
masterfrom
artonge/feat/improve_files_versions_preview_logic
Jun 30, 2023
Merged

Reduce load of files versions preview loading#38905
artonge merged 4 commits into
masterfrom
artonge/feat/improve_files_versions_preview_logic

Conversation

@artonge

@artongeartonge commented Jun 19, 2023

Copy link
Copy Markdown
Collaborator
  • Provide hasPreview in files_versions DAV API to prevent request on non-existing previews
  • Set properties of the <img> element to reduce preview loading to what the browser think is necessary
  • Load preview only when versions tab is active.

Especially useful when there are a lot of versions.

Comment threadapps/files_versions/lib/Sabre/Plugin.php Fixed
Comment threadapps/files_versions/lib/Sabre/VersionFile.php Fixed
@artonge

Copy link
Copy Markdown
CollaboratorAuthor

/backport to stable27

@artonge
artongeforce-pushed the artonge/feat/improve_files_versions_preview_logic branch from 635ee3b to f6be02eCompareJune 19, 2023 16:40
@artonge
artongeforce-pushed the artonge/feat/improve_files_versions_preview_logic branch from 2cfb3c8 to fe42647CompareJune 28, 2023 14:44
@artongeartonge changed the title Provide hasPreview in files_versions DAV APIReduce load due to files versions preview loadingJun 28, 2023
@artonge
artonge requested review from a team, Pytal, nfebe and skjnldsv and removed request for a team and skjnldsvJune 28, 2023 14:45
This allow to no request non existing previews
I also set some properties to the img element to reduce preview loading to what the browser think is necessary
Signed-off-by: Louis Chemineau <louis@chmn.me>
@artonge
artongeforce-pushed the artonge/feat/improve_files_versions_preview_logic branch from fe42647 to b93c084CompareJune 28, 2023 14:49
@artongeartonge added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jun 28, 2023
Comment threadapps/files_versions/src/components/Version.vue Outdated
Signed-off-by: Louis Chemineau <louis@chmn.me>
Signed-off-by: Louis Chemineau <louis@chmn.me>
@artonge
artongeforce-pushed the artonge/feat/improve_files_versions_preview_logic branch from b93c084 to 505a11bCompareJune 28, 2023 15:00
@artongeartonge changed the title Reduce load due to files versions preview loadingReduce load of files versions preview loadingJun 28, 2023
if ($user !== null) {
$propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, function () use ($node, $user) {
try {
$this->versionManager->getVersionFile(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have to double check, but I feel that this is somewhat expensive for the info we're trying to get here.

Preview availability is mostly determined by the mimetype, which you can get directly from the $node

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go idea, I changed the logic to use $previewManager->isMimeSupported(...)

@artonge
artonge requested a review from icewind1991June 29, 2023 09:29
@artonge
artongeforce-pushed the artonge/feat/improve_files_versions_preview_logic branch from d7f87e7 to 6d6e274CompareJune 29, 2023 10:07
Signed-off-by: Louis Chemineau <louis@chmn.me>
@artonge
artongeforce-pushed the artonge/feat/improve_files_versions_preview_logic branch from 6d6e274 to 05acd91CompareJune 29, 2023 10:09
@artonge
artonge merged commit d76f398 into masterJun 30, 2023
@artonge
artonge deleted the artonge/feat/improve_files_versions_preview_logic branch June 30, 2023 18:32
@backportbot-nextcloud

Copy link
Copy Markdown

The backport to stable27 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable27
git pull origin stable27
# Create the new backport branch
git checkout -b fix/foo-stable27
# Cherry pick the change from the commit sha1 of the change against the default branch# This might cause conflicts. Resolve them.
git cherry-pick abc123
# Push the cherry pick commit to the remote repository and open a pull request
git push origin fix/foo-stable27

More info at https://docs.nextcloud.com/server/latest/developer_manual/getting_started/development_process.html#manual-backport

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@artonge@icewind1991@skjnldsv@Pytal@github-advanced-security