-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Refactor element - use SGIDs where possible to minimize over-the-wire size #37
Conversation
6a8bd9d
to
7a781f9
Compare
So I have exhaustively gone over every line of this library, and looked up everything I didn't understand. I want to call out I remain incredibly impressed with the cleverness of this solution, but I am seeing some strange behaviour. First of all, here are the parameters of my testing. I have 100 instances of a class Post < ApplicationRecord
def to_partial_path
"home/post"
end
end I have two partials, post and card: _post.html.erb: <tr style="height: 100px">
<td><%= post.title %></td>
</tr> _card.html.erb: <div><%= message %> I'm here, now!</div> Finally, my test page looks like this: <h1>Futurism is now</h1>
<div style="margin-bottom: 1000px">⬇️ You'd better get scrolling...⬇️</div>
<%= futurize partial: "home/card", locals: {message: "Hello"}, extends: :div, html_options: {style: "color: blue"} do %>
<div class="spinner"></div>
<% end %>
<%= futurize "home/card", locals: {message: "Die, scum!"}, extends: :div, html_options: {style: "color: green"} do %>
<div class="spinner"></div>
<% end %>
<h2>TRs</h2>
<table>
<tbody>
<%= futurize @posts, extends: :tr, html_options: {style: "color: red"} do %>
<td class="placeholder"> </td>
<% end %>
</tbody>
</table> As I start to inch down the page with my element inspector open, I hit what I consider to be a strange scenario. I can see the I see this on my server console:
and I see this in my inspector: Both of the
I just tried it again:
So yeah, something is obviously fucked up. If I comment out the first partial block (using the
But, if I comment out the second partial block (string shortcut) and try again, I see:
Success! So it currently seems like calling the string shortcut version is broken. Now, if I try calling multiple card partials in a row, it works just fine, because the selector should always grab the next matching element on the page. <%= futurize partial: "home/card", locals: {message: "Hello"}, extends: :div, html_options: {style: "color: blue"} do %>
<div class="spinner"></div>
<% end %>
<%= futurize partial: "home/card", locals: {message: "Goodbye"}, extends: :div, html_options: {style: "color: purple"} do %>
<div class="spinner"></div>
<% end %>
<h2>TRs</h2>
<table>
<tbody>
<%= futurize @posts, extends: :tr, html_options: {style: "color: red"} do %>
<td class="placeholder"> </td>
<% end %>
</tbody>
</table>
In conclusion, I think PR#37 is good! But I suspect that something is off with the shorthand syntax. |
@all-contributors add @leastbad for code and review |
I've put up a pull request to add @leastbad! 🎉 |
Refactor
Description
Clean up the internals a bit, create a wrapper class for a futurism
Element