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

WebDAV is fetched twice on initial page load #45882

Open
juliusknorr opened this issue Jun 14, 2024 · 15 comments · Fixed by #47102
Open

WebDAV is fetched twice on initial page load #45882

juliusknorr opened this issue Jun 14, 2024 · 15 comments · Fixed by #47102

Comments

@juliusknorr
Copy link
Member

Steps to reproduce

  • Load the files app through /apps/files
  • Observe the network requests

Current behaviour

The PROPFIND on the root directory is sent twice

Actual behaviour

Only one request should be done

Additional context

Reproducible on 29.0.2 and latest master

Screenshot 2024-06-14 at 14 59 17

@nextcloud/server-frontend

@juliusknorr juliusknorr added bug 1. to develop Accepted and waiting to be taken care of performance 🚀 labels Jun 14, 2024
@juliusknorr
Copy link
Member Author

Same is actually the case when going to the recents view and reloading the page

@skjnldsv
Copy link
Member

skjnldsv commented Jun 14, 2024

// reload on settings change
this.unsubscribeStoreCallback = this.userConfigStore.$subscribe(() => this.fetchContent(), { deep: true })

Coming from here @susnux

image

@susnux
Copy link
Contributor

susnux commented Jun 14, 2024

Probably it triggers a settings change directly on init?
Or the view is loaded before the settings?

@skjnldsv
Copy link
Member

Or the view is loaded before the settings?

probably that

@juliusknorr
Copy link
Member Author

It seems things got worse, so maybe worth to schedule looking into this @sorbaugh

just noticed on my local instance it is doing 4 propfinds against the root on a page load, same on our prod.

@skjnldsv
Copy link
Member

skjnldsv commented Aug 7, 2024

On it

@skjnldsv skjnldsv self-assigned this Aug 7, 2024
@susnux
Copy link
Contributor

susnux commented Aug 7, 2024

I think the reason why it is increasing is that there is no other way for other apps to load the current content.

Meaning if you need the current content of the files app, you have to use view::getContent there is no way to get a cached version of the current content.
So if we do not want to introduce new API, we could just extend the current by adjusting View::getContents to have a parameter force = true (most secure backwards compatibility).

This would not need any adjustments of using apps, as the ViewData could stay as it is (so the View constructor call), but we just need to adjust the View class to cache the returned value for a given path and only call the ViewData::getContents when force is set.

@skjnldsv
Copy link
Member

skjnldsv commented Aug 7, 2024

Yes and no, there are various issues:

  1. the filter indeed gets their own contents
  2. The Filelist monitors any userConfig store changes, so it gets triggered again on initial populating
  3. The uploader fetch its own content on init too

I'll address 2 and 3 in a minute, still thinking about 1

Basically there was 2 content fetched, and #45708 added 2 more

@skjnldsv skjnldsv added 2. developing Work in progress and removed 1. to develop Accepted and waiting to be taken care of labels Aug 7, 2024
@skjnldsv
Copy link
Member

skjnldsv commented Aug 7, 2024

@susnux
Copy link
Contributor

susnux commented Aug 7, 2024

Nice fixes :)

But I still think we need a way to access the current content without require to refetch, this was possible in legacy file list, but now the only option is view.getContents which is not cached.
Not only for us here but also potentially for other apps that hook into files API.

@skjnldsv
Copy link
Member

skjnldsv commented Aug 7, 2024

@susnux what about an etag on root, or a similar approach?
Then a very tiny request would be easy to know if we're out of date?

@skjnldsv skjnldsv reopened this Aug 7, 2024
@skjnldsv
Copy link
Member

skjnldsv commented Aug 7, 2024

Let's re-open for the filter issue

const { contents } = await currentView.value.getContents(path)

@susnux
Copy link
Contributor

susnux commented Aug 13, 2024

Then a very tiny request would be easy to know if we're out of date?

Yes for some parts this would be quite a nice improvement.
But it does not solve this issue, as it would still cause a full request, as we do not know any node.

Also if there are more apps, this issue will grow as each app needs to request the etag.

So we could do both, use the etag and allow getting a cached version.

@skjnldsv skjnldsv removed their assignment Aug 13, 2024
@skjnldsv skjnldsv added 1. to develop Accepted and waiting to be taken care of and removed 2. developing Work in progress labels Aug 13, 2024
@provokateurin
Copy link
Member

Photos app has the same problem btw, not sure if that will be fixed automatically if it is fixes for Files.

@solracsf
Copy link
Member

solracsf commented Sep 9, 2024

I don't know if this is related, but many (8 out of 10) PROPFIND requests seen by nginx are doubled, the first being aborted "by the client" (code 499):

PROPFIND /remote.php/dav/files/user/folder/ http_code=499
PROPFIND /remote.php/dav/files/user/folder/ http_code=207

v28.0.9, no sync/webdav clients involved (100% web).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants