When you have assertions enabled and visit a product, this error happens at the moment:
AssertionError: When a #lazy_builder callback is specified, no properties can exist; all properties must be generated by the #lazy_builder callback. You specified the following properties: #attached. in assert() (line 390 of core/lib/Drupal/Core/Render/Renderer.php).
Thatβs because using BubbleableMetadata in \Drupal\commerce_add_to_wishlist_link\AddToWishlistLink::build() adds attached to that element.
Enable assertions.
Switching to CacheableMetadata avoids that
Iβm not sure if the cacheable metadata on that level is even necessary since you force a a lazy builder anyway. It probably should be inside the lazy buildered part. I would need to dig deeper on that to see if it gets bubbled up.
Active
2.0
Code