Skip to content

Commit

Permalink
Cache more sidebar partials at the user instance
Browse files Browse the repository at this point in the history
- Caches application/sidebar/observations and application/sidebar/species_lists at the user instance
because they contain links at the user instance to
Your Observations and Your Lists
  • Loading branch information
JoeCohen committed Jan 19, 2024
1 parent b8cae47 commit 90b1216
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions app/views/controllers/application/_sidebar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,32 @@ classes = {
<%= render(partial: "application/sidebar/login",
locals: { classes: classes }) %>
<% end %>
<% end %>
<%= render(partial: "application/sidebar/observations",
locals: { classes: classes }) %>
<%# Cache customized for the user instance because of Your Observations.%>
<% cache(@user) do %>
<% if @user %>
<%= render(partial: "application/sidebar/observations",
locals: { classes: classes }) %>
<% end %>
<% end %>
<%# Cache depends only on user status (logged-in? admin?) %>
<% cache([user_status_string]) do %>
<%= render(partial: "application/sidebar/latest",
locals: { classes: classes }) %>
<% end %>
<%= render(partial: "application/sidebar/species_lists",
locals: { classes: classes }) if @user %>
<%# Cache customized for the user instance because of Your Lists.%>
<% cache(@user) do %>
<% if @user %>
<%= render(partial: "application/sidebar/species_lists",
locals: { classes: classes }) if @user %>
<% end %>
<% end %>
<%# Cache depends only on user status (logged-in? admin?) %>
<% cache([user_status_string]) do %>
<%= render(partial: "application/sidebar/indexes",
locals: { classes: classes }) if @user %>
Expand Down

0 comments on commit 90b1216

Please sign in to comment.