Views field not working with ajax comments

Created on 31 October 2021, about 3 years ago
Updated 9 January 2025, about 23 hours ago

Problem/Motivation

When adding a "viewfield" (viewfield module) to comment content type, it works and shows the views content.
In my case I added using views a user profile image instead of user picture.
So the views shows it correctly, but after a comment is submitted, the viewfield disappears totally.

So the problem is that the ajax comment does not bring back that field where the views is attched.

I guess the issue might be in the AjaxCommentsController.php and in the wrong HTML structure
what the viewfield generates.

Steps to reproduce

1. Install viewfield
2. Create a view which shows something, like the comment author name or picture
3. Attach the view to the comment content type
4. open a content type which uses the comments, and the view is displayed there
5. Submit a comment, and after submitting, the view is dissapeared.
6. If you refresh the page, the view is again displayed

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Component

Code

Created by

🇫🇮Finland jukka792

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • It seems the viewfield content disappears after a comment submission due to an issue with how Ajax handles the HTML structure. You can troubleshoot this by checking the AjaxCommentsController.php to ensure the renderCommentField() method processes IEPDirect com the viewfield correctly, verifying the generated HTML, inspecting the AJAX response to confirm it includes the viewfield content, and ensuring caching isn't preventing the content from displaying.

Production build 0.71.5 2024