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
When use content_for with yield_content, output duplicate page content. #636
Comments
Current, i use version: 1.1.2, but, i can reproduce this on the master, i can reproduce it on d53d253 too ╰─ $ shards list
Shards installed:
* kemal (1.1.2 at d53d253)
* radix (0.4.1)
* exception_page (0.2.2)
* backtracer (1.2.1)
* avram (0.23.0)
* lucky_task (0.1.1)
* pg (0.26.0)
* db (0.11.0)
* habitat (0.4.7)
* wordsmith (0.3.0)
* dexter (0.3.4)
* shell-table (0.9.3)
* pulsar (0.2.3)
* lucky_cache (0.1.1)
* splay_tree_map (0.2.2)
* habitat (0.4.7)
* cadmium_transliterator (0.1.0 at 46c4c14) |
I can confirm, my installed kemal version include those changes in #630 |
Hi, if need more context for this issue? if you want, please tell me, i will add it here. |
@zw963 I tried to reproduce the issue and could not reproduce. Here's the repo that I used to reproduce https://github.com/sdogruyol/kemal-layout-bug, could you please clone and run this on your local and see if it works on your side too? |
Yes, i can, please check following screenshot. BTW: i consider there exists some syntax error on view, i fixed, please check following diff. ╰─ $ git diff
diff --git a/src/views/home.ecr b/src/views/home.ecr
index fb85025..df95b8a 100644
--- a/src/views/home.ecr
+++ b/src/views/home.ecr
@@ -1,6 +1,6 @@
<h1> Title 1</h1>
<h2> Title 2</h2>
-<% content_for "title" %>
+<% content_for "title" do %>
<title>Inner Title</title>
-<% %>
\ No newline at end of file
+<% end %> Above diff i create a PR for it. sdogruyol/kemal-layout-bug#1 |
Thank you @zw963, I can reproduce it now 👍 I'll look into what's going on |
@sdogruyol , it works! thank you. |
Description
We assume have following view code.
i render it like this:
Will result in:
This issue only happen when used content_for in view with yield_content in layout.
if remove one of them, render result correct.
Expected behavior: [What you expect to happen]
I should never render duplicate content twice.
Actual behavior: [What actually happens]
Reproduces how often: [What percentage of the time does it reproduce?]
always.
Versions
Crystal 1.5.0-dev [0123976d8] (2022-06-09)
LLVM: 13.0.1
Default target: x86_64-pc-linux-gnu
Arch Linux.
i can reproduce on 1.4.1 too.
The text was updated successfully, but these errors were encountered: