-
Notifications
You must be signed in to change notification settings - Fork 179
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
Introduce lazy loading #88
Introduce lazy loading #88
Conversation
Thanks, for that detailed work. I would move the detailed explanation here, because you not only explain the problem, but also your solution. I ping @nextcloud/contacts @ChristophWurst for review! |
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.
Amazing work! It was next on my todo list! 🎉
I will review it deeply as soon as possible!
templates/group.html
Outdated
@@ -1 +1 @@ | |||
<a ng-href="#/{{ctrl.group}}">{{ctrl.group}}</a> | |||
<a ng-href="#/{{ctrl.group}}">{{ctrl.group}} ({{ctrl.groupCount}})</a> |
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.
Please format menus according to guidelines: https://docs.nextcloud.com/server/11/developer_manual/app/css.html#menus
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.
Done.
@@ -0,0 +1,12 @@ | |||
// from https://docs.nextcloud.com/server/11/developer_manual/app/css.html#menus | |||
angular.module('contactsApp') |
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.
Please add tests (seehttps://github.com/owncloud/contacts/blob/31e403af1db859f85e84c2337134e20e5719c825/js/tests/filters/counterFormatter_filter.js)
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.
Done.
templates/group.html
Outdated
@@ -1 +1 @@ | |||
<a ng-href="#/{{ctrl.group}}">{{ctrl.group}} ({{ctrl.groupCount}})</a> | |||
<a ng-href="#/{{ctrl.group}}">{{ ctrl.group }} ({{ ctrl.groupCount | counterFormatter }})</a> |
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.
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.
In order to get right-aligning instead of parentheses I gather. Sure thing, fixed.
templates/groupList.html
Outdated
@@ -1 +1 @@ | |||
<li ng-repeat="group in ctrl.groups" group data="group" ng-click="ctrl.setSelected(group)" ng-class="{active: group === ctrl.getSelected}"></li> | |||
<li ng-repeat="group in ctrl.groups" group group-name="group[0]" group-count="group[1]" ng-click="ctrl.setSelected(group[0])" ng-class="{active: group[0] === ctrl.getSelected}"></li> |
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.
you could do something like <li ng-repeat="(group, count) in ctrl.groups" group data="group" count="count" ng-click="ctrl.setSelected(group)" ng-class="{active: group === ctrl.getSelected}"></li>
for better readibility :)
See my previous work: https://github.com/owncloud/contacts/pull/341/files
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.
Oh, did not know that Angular does list destructuring, will fix.
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.
Hmm, it seems that that syntax is only used for going through the keys and values in an object.
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.
Isn't there an alternative?
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.
The order of keys in an object is arbitrary, so I don't want to have the whole ctrl.groups
be an object. We want to guarantee All Contacts
is first.
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.
Too bad, it would have been great to improve the readability. But it's clearly not that important :)
ctrl.setSelectedId(ctrl.contactList[0].uid()); | ||
} | ||
var firstNames = ctrl.contactList.slice(0, 20).map(function (c) { return c.displayName(); }); | ||
ContactService.getFullContacts(firstNames); |
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.
We still don't want to load the first contact in mobile mode.
We need a condition to prevent that like we had before ;)
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.
We now never blindly load the first contact, so not on mobile either.
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.
By selecting the first uid after load, we display the first contact.
In mobile, since the list view and detail views are split, we need to stay on the contact list only. :)
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 don't think we are selecting the first uid at all. I tested with both a responsive design mode and an actual mobile browser.
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.
So the right app panel is blank on your contact installation? On fresh click of your.domain/index.php/apps/contacts
, the app doesn't load a contact?
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.
Exactly.
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.
Strange, it changes the url with an uid and then load a contact in my installation.
Anyway, we need to keep the old mechanic in place.
- If mobile, do not load contact details and stay on the contacts list EXCEPT if there is a matching uid specified in the url
- If not in mobile, load the first contact
Edit: error in my environment. It doesn't load a thing indeed.
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.
Ok, added that back in. It adds ~400 ms rendering time, but in the scheme of things that's probably fine.
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.
You're awesome! :)
If no contacts, I get errors on the console:
|
I added a defense in contactList_controller. |
} else { | ||
// custom console | ||
// eslint-disable-next-line no-console |
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.
Nice! 😆
@skjnldsv did you want me to still do things? Like rebase with signed off commits? |
Not really. But we need to wait for the 3rdparty patch/sabre release. |
Any idea when this sabre patch release is coming? cc @evert |
I don't know. I asked on their IRC channel a couple of weeks ago and got no reply. I asked two days ago on Github (https://github.com/fruux/sabre-dav/issues/936), but haven't gotten any reply yet. |
I'd suggest to split this up into two separate pull requests:
I'd like to merge the second one as soon as possible, because it might introduce a nice performance improvement and also to reduce merge conflicts in the future. @daniellandau what do you think about this? would you do the job of splitting this PR up? |
Do you mean as the second part the thing that renders the contact list piece by piece? I'd rather just merge the sabre-dav patch and merge this whole thing. All in all that would be much less maintenance work in my opinion, and the sabre-dav patch is merged in all branches upstream, so it shouldn't cause conflicts or problems later on either. |
@daniellandau shouldn't cause any conflicts. But I also understand that the guys over at nextcloud/server don't want to patch anything unreleased into their 3rdparty repo. Let's wait a bit longer for a response by sabre/dav. |
Just a quick update, the sabre/dav release has come, and the current PR on 3rdparty is nextcloud/3rdparty#40 |
Signed-off-by: Daniel Landau <daniel@landau.fi>
Signed-off-by: Daniel Landau <daniel@landau.fi>
It's a really heavy operation that hangs the browser Signed-off-by: Daniel Landau <daniel@landau.fi>
If we render the whole thing at once, the browser hangs. This way we can render the beginning of the list and the user can start to either scroll or search for better results. Signed-off-by: Daniel Landau <daniel@landau.fi>
Signed-off-by: Daniel Landau <daniel@landau.fi>
This requires an updated SabreDav in core. The contents of address-data are ignored before https://github.com/fruux/sabre-dav/issues/889 Signed-off-by: Daniel Landau <daniel@landau.fi>
Signed-off-by: Daniel Landau <daniel@landau.fi>
Signed-off-by: Daniel Landau <daniel@landau.fi>
Signed-off-by: Daniel Landau <daniel@landau.fi>
This is to ensure that they really are loaded when changeContact is run Signed-off-by: Daniel Landau <daniel@landau.fi>
Signed-off-by: Daniel Landau <daniel@landau.fi>
Signed-off-by: Daniel Landau <daniel@landau.fi>
Signed-off-by: Daniel Landau <daniel@landau.fi>
Signed-off-by: Daniel Landau <daniel@landau.fi>
Signed-off-by: Daniel Landau <daniel@landau.fi>
Signed-off-by: Daniel Landau <daniel@landau.fi>
a5b210b
to
e628a73
Compare
I rebased the PR to current master, ping @skjnldsv. |
Codecov Report
@@ Coverage Diff @@
## master #88 +/- ##
==========================================
- Coverage 16.42% 15.89% -0.54%
==========================================
Files 50 51 +1
Lines 1023 1095 +72
==========================================
+ Hits 168 174 +6
- Misses 855 921 +66
Continue to review full report at Codecov.
|
If I'm not mistaken, the REPORT functionality (https://github.com/fruux/sabre-dav/issues/889) is only included starting from sabre-dav 3.0.10 (https://github.com/fruux/sabre-dav/blob/master/CHANGELOG.md#3010-2016--) which isn't released (by now?) and only sabre-dav 3.2.1 (https://github.com/fruux/sabre-dav/blob/master/CHANGELOG.md#321-2017-01-28) seems to support the REPORT functionality . sabre-dav in Nextcloud 9 was only bumped to sabre-dav 3.0.9 (https://github.com/nextcloud/3rdparty/tree/stable9/sabre), which means we wouldn't support Nextcloud 9 anymore by now. And sabre-dav in Nextcloud 10 was also only bumped to sabre-dav 3.0.9 (https://github.com/nextcloud/3rdparty/tree/stable10/sabre), which also means no support for Nextcloud 10 anymore by now. And sabre-dav in Nextcloud 11 was also only bumped to sabre-dav 3.2.0 (https://github.com/nextcloud/3rdparty/tree/stable11/sabre), which also means no support for Nextcloud 11 anymore by now. 👎 I'm not willing to merge this PR into the master branch, which would basically mean that the next version of contacts would only be compatible with Nextcloud 12. ---> After some testing, if the REPORT feature is not supported, it still seems to work (requested properties are ignored?) |
Yes, the properties are simply ignored. There's some extra network traffic when the browsers asks for the visible cards again (as they are already fully downloaded in the beginning). |
@LukasReschke @MorrisJobke care to check this out? :) Would be great to get your opinion on this. |
Sadly I don't have time for this :/ |
Anyone else who can help here? @rullzer @schiessle @nickvergessen @georgehrke |
🎉 |
Great work everyone! :) |
Does "renders the contact list piece by piece" translate to "infinite scrolling", 'cos that would be really great. I have 4 adress books shared with different people, totalling around 1300 contacts, and the load time is lousy, even on a fast linux PC with fast cable internet. It would be great, really great, if I could select which of the adress books should be displayed (BEFORE they are) - I would have thought that an elementary feature. And a client of mine uploaded about 15.000 contacts to one adress book; since then it has been unusable and would have to be deleted manually from the DB (igitt). So yes, infinite scrolling / lazy loading or whatever we call it would imho be neccessary for professional use. Or even/also the possibility to limit the display to first name / last name beginning with... Many thanks to all working on this! |
This is related to #12