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

Rendering partial over collection with cached: true leave out same items #35114

Closed
foton opened this issue Jan 31, 2019 · 2 comments
Closed

Rendering partial over collection with cached: true leave out same items #35114

foton opened this issue Jan 31, 2019 · 2 comments

Comments

@foton
Copy link

foton commented Jan 31, 2019

Steps to reproduce

I have view with:

<% same_sets = [
  [1,2,3,4,5],
  [1,2,3,4,5],
  [1,2,3,4,4],
  [1,2,3,4,4],
  [1,2,3,4,6],
]%>
with 'cached: true'<br />
<%= render partial: 'test_row', collection: same_sets, cached: true %>
<br />
with 'cached: false'<br />
<%= render partial: 'test_row', collection: same_sets, cached: false %>
<br />

and corresponding partial _test_row.html.erb :

<%= test_row.first %> | <%= test_row.second %> | <%= test_row.third %> | <%= test_row.fourth %> | <%= test_row.fifth %><br />

That view will produce this result:

with 'cached: true'
1 | 2 | 3 | 4 | 5
1 | 2 | 3 | 4 | 4
1 | 2 | 3 | 4 | 6

with 'cached: false'
1 | 2 | 3 | 4 | 5
1 | 2 | 3 | 4 | 5
1 | 2 | 3 | 4 | 4
1 | 2 | 3 | 4 | 4
1 | 2 | 3 | 4 | 6

Expected behavior

For array with size 5, I expect 5 rows, with or without caching.

Actual behavior

For array with size 5, I got 3 (different) rows with caching enabled.

System configuration

Rails version: 5.2.2

Ruby version:
2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]

@st0012
Copy link
Contributor

st0012 commented Feb 3, 2019

I think this is a bug and I can reproduce it in latest master as well.

@y-yagi
Copy link
Member

y-yagi commented Apr 4, 2019

Fixed by #35145

@y-yagi y-yagi closed this as completed Apr 4, 2019
eileencodes added a commit that referenced this issue Apr 22, 2019
Update changelog to explain the fix of #35114 [ci skip]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants