-
Notifications
You must be signed in to change notification settings - Fork 12
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
feat(view): Allow reactive files view content #918
Conversation
Allow views to accept a callback to call if the current content has changed (e.g. user settings etc). Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #918 +/- ##
=======================================
Coverage 77.50% 77.50%
=======================================
Files 17 17
Lines 440 440
Branches 118 118
=======================================
Hits 341 341
Misses 98 98
Partials 1 1 ☔ View full report in Codecov by Sentry. |
Can you explain what view reactivity issues you're facing?
Any setting in particular? |
Problem I want to solve:
For the last one we need to update the root response of |
Need this for nextcloud/server#44651 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think adjusting this should be simpler and enough
The complexity layer added by https://github.com/nextcloud/server/pull/44651/files is far too much
I did this before, but it does not work out as it is dependent to the view you are in. |
Following problem:
Also currently it is not possible to react on content changes for other views than the default one. |
Second suggestion, have the current view reload when a setting change 🤷 |
Yes but this causes a lot of unnecessary reload and waiting time. Because if not doing a hard reload the files list will not reload. What do you think about an other option: Emitting an |
Events are not here to trigger a chain reaction, but to notify a reference change. |
Ah, I see the misunderstanding. I meant a file reload, not the full view. Just a |
But also that will cause a lot of unneeded reloads, because the view can not decide if needed (even if it knows) but is forced to do. |
But yes that would be possible |
server only solution: |
Allow views to accept a callback to call if the current content has changed (e.g. user settings etc).
For example if a view changed while the user is still on the same view, the files app content currently will not update.
This allows reactive content (another way would be to allow Vue reactive return values but this brings other problems as soon as files app and app registering the view have different Vue versions).
So a simple vanilla JS solution is to provide a callback to call when we need to inform the files app that the current view has changed and it needs to refetch the content.