Skip to content

Pass in a block to render_async

Compare
Choose a tag to compare
@nikolalsvk nikolalsvk released this 21 Sep 12:08
· 270 commits to master since this release

You can now pass in a block that will act as a placeholder.

If you want to add some feedback before your AJAX request is finished, passing a block is the way.

Example:

<%= render_async movie_path do %>
  <div class="cool-spinner"></div>
<% end %>

Now you will have the spinner (or anything you like) show before AJAX call finishes.

BREAKING_CHANGE:

This is a breaking change for those who relied on the <div> elements that we're rendered before
AJAX call.

Mentioned div element:

<div class="sk-spinner sk-spinner-double-bounce">
  <div class="sk-double-bounce1"></div>
  <div class="sk-double-bounce2"></div>
</div>

Those elements were there for spinner purposes but are removed from this version.