Nantes
Account created on 10 May 2016, about 8 years ago
#

Merge Requests

Recent comments

πŸ‡«πŸ‡·France zewebmaster Nantes

Hi,

Thanks for your quick reply, and sorry about the noise!
I'll take a closer look at version 2 of the module and see what can be done!

I suppose you can close this issue.

Thanks again :)

πŸ‡«πŸ‡·France zewebmaster Nantes

zewebmaster β†’ changed the visibility of the branch 2.x to hidden.

πŸ‡«πŸ‡·France zewebmaster Nantes

Hi @ttesteve,

I face a similar problem when trying to use this module on a comment thread.

In my case, it turns out that in the Ajax callback LikeForm::ajaxSubmit, the entity embedded in the form validated (by clicking on the like button) always corresponds to my commented entity and not to the liked comment entity.

# function LikeForm::ajaxSubmit

/** @var \Drupal\Core\FieldItemInterface $item */
$item = $form['#item'];
$entity = $item->getEntity();

I've tried to replicate the problem you describe by creating a very simple paginated view that displays teasers - as I understand your problem. And in the same way, the problem is quite similar and the entity loaded in the Ajax callback corresponds to the first item in the list of the current page and not to the liked entity => which causes the side effects you describe.

I've tried to correct the problem in several ways:

* By passing the entity into a field of type value => This doesn't change anything!

* By using fields of type hidden to retrieve the metadata of the liked entity and load it into the callback => this works, although I'm not sure it's the most appropriate way of doing it.

I therefore propose this correction. Don't hesitate to let me know if it fixes the bug you're experiencing.

πŸ‡«πŸ‡·France zewebmaster Nantes

zewebmaster β†’ made their first commit to this issue’s fork.

Production build 0.69.0 2024