Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce load of files versions preview loading #38905

Merged
merged 4 commits into from
Jun 30, 2023

Conversation

artonge
Copy link
Contributor

@artonge artonge commented Jun 19, 2023

  • 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.

@artonge
Copy link
Contributor Author

artonge commented Jun 19, 2023

/backport to stable27

@artonge artonge force-pushed the artonge/feat/improve_files_versions_preview_logic branch from 635ee3b to f6be02e Compare June 19, 2023 16:40
@artonge artonge force-pushed the artonge/feat/improve_files_versions_preview_logic branch from 2cfb3c8 to fe42647 Compare June 28, 2023 14:44
@artonge artonge changed the title Provide hasPreview in files_versions DAV API Reduce load due to files versions preview loading Jun 28, 2023
@artonge artonge requested review from skjnldsv, Pytal, a team and Fenn-CS and removed request for skjnldsv and a team June 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 artonge force-pushed the artonge/feat/improve_files_versions_preview_logic branch from fe42647 to b93c084 Compare June 28, 2023 14:49
@artonge artonge added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jun 28, 2023
Signed-off-by: Louis Chemineau <louis@chmn.me>
Signed-off-by: Louis Chemineau <louis@chmn.me>
@artonge artonge force-pushed the artonge/feat/improve_files_versions_preview_logic branch from b93c084 to 505a11b Compare June 28, 2023 15:00
@artonge artonge changed the title Reduce load due to files versions preview loading Reduce load of files versions preview loading Jun 28, 2023
if ($user !== null) {
$propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, function () use ($node, $user) {
try {
$this->versionManager->getVersionFile(
Copy link
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
Contributor Author

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 icewind1991 June 29, 2023 09:29
@artonge artonge force-pushed the artonge/feat/improve_files_versions_preview_logic branch from d7f87e7 to 6d6e274 Compare June 29, 2023 10:07
Signed-off-by: Louis Chemineau <louis@chmn.me>
@artonge artonge force-pushed the artonge/feat/improve_files_versions_preview_logic branch from 6d6e274 to 05acd91 Compare June 29, 2023 10:09
@artonge artonge merged commit d76f398 into master Jun 30, 2023
@artonge artonge deleted the artonge/feat/improve_files_versions_preview_logic branch June 30, 2023 18:32
@backportbot-nextcloud
Copy link

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 free to 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.

4 participants