The initial load of the Membership page can be quite lengthy, especially if the user has a lot of memberships. There is an obvious performance improvement opportunity:
- the code is asking for all the Site objects twice; once for display purposes and once for obtaining the size of the list
- changing the latter to call countSites() rather than getSites() equates to large performance gains
There is also a bug in the code where the page size would be incorrect if you had used the filter results functionality. The search term needs to be input into the API call to determine the size of the list.