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

fix(files): allow triggering a Files reload directly #50354

Closed
wants to merge 1 commit into from

Conversation

skjnldsv
Copy link
Member

Should simplify how we interact.
Sometimes it make sense to also just trigger a full reload directly 🤷

@susnux, thoughts?
I'm not 100% sire this makes sense 🤔

@skjnldsv skjnldsv requested review from susnux and a team January 23, 2025 12:10
@skjnldsv skjnldsv self-assigned this Jan 23, 2025
@skjnldsv skjnldsv requested review from nfebe and szaimen and removed request for a team January 23, 2025 12:10
@skjnldsv skjnldsv requested a review from artonge January 23, 2025 12:11
@szaimen szaimen removed their request for review January 23, 2025 12:32
Copy link
Contributor

@susnux susnux left a comment

Choose a reason for hiding this comment

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

Currently not sure about that.

Maybe we even need somekind of auto-reload in the files app, e.g. if there are too many updates then we do a background fetch to sync.
Also maybe do it regular in the background to get new files created by other tabs / sync clients (every minute if the user is not AFK.

if (!window?.OCP?.Files?.App) {
window.OCP.Files.App = {}
}
Object.assign(window.OCP.Files.App, { ...window.OCP.Files.App, reload: this.fetchContent })
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should not add anything new to window.OCP, this should die IMHO.

What is the general use case? Files got converted? Can we not just emit afiles:node:created?
Because we currently already have events for node deletion / creation / update, so everything in the current directory could be modified and changing the directory will cause a reload anyways.

But if we need a reload mechanism, why not provide a reload method in the file router, could fit there. OCP.Files.Router.reload() or maybe just an event files:reload.

Copy link
Member Author

Choose a reason for hiding this comment

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

What is the general use case? Files got converted? Can we not just emit afiles:node:created? Because we currently already have events for node deletion / creation / update, so everything in the current directory could be modified and changing the directory will cause a reload anyways.

That would be the smartest approach. But could be overly complicated.
Thanks for reminding me to not take shortcuts, I'll do the following:

  1. if the current folder matches one of the converted files
  2. then we fetch each files
  3. and we trigger a files:node:created

Copy link
Member Author

Choose a reason for hiding this comment

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

Exactly what I needed for feedback @susnux ! ❤️ 🤗

apps/files/src/actions/convertUtils.ts Show resolved Hide resolved
@skjnldsv skjnldsv closed this Jan 24, 2025
@skjnldsv skjnldsv deleted the fix/files-reload branch January 24, 2025 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants