- Issue created by @juagarc4
- π·π΄Romania bbu23
Hi,
Thanks for reporting this issue, I'll try to reproduce it when I get the chance.
The cache keys is an array of parts. In the case of node, a example is "['node', 5, 'teaser']". This means that the teaser representation of the node will be cached, but in Swiper's case it was a conflict because swiper is altering the representation. By adding the "swiper-slide" key we are creating two different "cache keys" depending on the scenario. And in theory, they are supposed to be unique. Randomising is not an option, so I first need to try to reproduce your scenario and investigate what happens to understand better.
More information about the original issue here: https://www.drupal.org/project/swiper_formatter/issues/3395406 π Swiper formatter fails to wrap row in swiper-slide div intermittently Active
- π·π΄Romania bbu23
Though from your screenshots it might look like the keys are empty, so yes, in that particular case, the cache keys array will only contain the same key for all which is incorrect. Makes sense, I'll investigate.
- Merge request !16Issue #3488101: Display as "Swiper Entity" shows the same image in all slider elements β (Merged) created by bbu23
- π·π΄Romania bbu23
I have provided a fix for this, thanks again for reporting this issue.
We made a small typo mistake when porting from version 1 to version 2. Please try out the patch and let us know if everything okay now.
Regarding the Proposed steps, 8 & 9 are not necessary, but of course can be tested. This bug can be reproduced for any entity reference, and in this particular example after step 7 the block can be added directly to the block layout and will have the same behaviour.
- πΊπΈUnited States the_turk
I am having the same issue even after applying the patch.
- π·π΄Romania bbu23
Did you clear the caches after applying the patch? @the_turk
- πΊπΈUnited States kerrymick Chicago
@bbu23 I work with @the_turk. I believe our issue is actually that we are using the format of swiper paragraphs, not swiper entity which also has the same issue of displaying the same slide. If we disable cache we get different slides.
- π·π΄Romania bbu23
@kerrymick in this case, please describe the exact steps to reproduce your case, and when I get the time I'll check. Thanks
- π¨πSwitzerland juagarc4
Hi all,
@bbu I just tested the current patch and it works in the case described in the issue.
Then I've tested it with paragraphs too and I can confirm the same problem mentioned by @the_turk and @kerrymick.
The steps are pretty simple:
1. Create a Paragraph "Slide" and add a new field of type Media or Image. Set the multiplicity limited to 1
2. In the Manage Display of the paragraph you can just set "Rendered Entity" as Formatter for the field.
3. Create a new Block Type "Gallery" and a new field of type "Paragraph"
4. Select Slide as "Paragraph Type" and set the multiplicity to unlimited.
5. In the Manage Display of the block set "Swiper paragraph" as a formatter for the field.
6. Create a Block in "Content > Blocks" with name Gallery
7. Add some slides to to the block.
8. Create content type or use one already existent which uses Layout builder
9. Create a node of this content type and add the custom Block "Gallery" you created in the step 6. - π·π΄Romania bbu23
@juagarc4 thank you for providing the detailed steps. I'll try to reproduce as soon as I get the chance.
- π·π΄Romania bbu23
Hi,
I updated the MR. Please let me know if this fixes both issues.
- πΊπΈUnited States kerrymick Chicago
I can confirm that this fixes our issue with entity references on paragraphs. Thanks so much!
- π¨πSwitzerland juagarc4
Hi all,
I re-tested it with paragraphs and I can confirm too, that the MR solves the problem.
Many thanks and regards!!!
- π·π΄Romania bbu23
Thanks so much for confirming, reporting and helping with testing!
Automatically closed - issue fixed for 2 weeks with no activity.