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

improves profile speed by moving the activity tab into lazy load #4760

Merged
merged 3 commits into from
Jul 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/assets/v2/js/pages/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ $(document).ready(function() {

if (ignoreScrollOffset || window.scrollY >= tabSection.scrollHeight) {
const activityName = activityContainer.id;
let page = parseInt(activityContainer.getAttribute('page')) || 1;
let page = parseInt(activityContainer.getAttribute('page')) || 0;

fetchInProgress = true;
loadingImg.className = loadingImg.className.replace('hidden', 'visible');
Expand Down
10 changes: 6 additions & 4 deletions app/dashboard/templates/profiles/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,12 @@ <h1 class="profile-header__handle">
<div class="container">
<div class="row mb-3 p-2">
<div id="{{ tab.id }}" class="col-12 activities" count="{{ tab.count }}">
{% if tab.type == 'activity' %}
{% include 'profiles/profile_activities.html' with activities=tab.objects %}
{% else %}
{% include 'profiles/profile_bounties.html' with bounties=tab.objects %}
{% if show_activity %}
{% if tab.type == 'activity' %}
{% include 'profiles/profile_activities.html' with activities=tab.objects %}
{% else %}
{% include 'profiles/profile_bounties.html' with bounties=tab.objects %}
{% endif %}
{% endif %}
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions app/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2074,6 +2074,7 @@ def profile(request, handle):
}

return JsonResponse(msg, status=msg.get('status', 200))
context['show_activity'] = request.GET.get('p', False) != False
return TemplateResponse(request, 'profiles/profile.html', context, status=status)


Expand Down