As far as I can tell, the preview does not work when creating new content.
It shows the page, but all fields remain blank, while they populate as content is entered on edit pages.

| Comment | File | Size | Author |
|---|---|---|---|
| #19 | problem.gif | 278.5 KB | jonloh |
| #16 | Screenshot 2024-08-12 at 8.01.35 AM.png | 15.85 KB | cosmicdreams |
| #10 | Afterpreview.png | 167.93 KB | dishakatariya |
| #10 | beforepreview.png | 116.17 KB | dishakatariya |
| #7 | Screencast from 25-07-24 05:27:33 PM IST.mp4 | 10.61 MB | atul_ghate |
Issue fork same_page_preview-3462436
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
iancawthorne commentedComment #3
cedricl commentedAlso noticed this issue after updating form 2.1.3 to 2.1.4. I downgraded for now, but might be a good thing to look at changes made from 2.1.3 to 2.1.4.
Comment #4
iancawthorne commentedYes, I can confirm that is the case for me too. Works on create pages on 2.1.3, but not on 2.1.4.
Comment #5
atul_ghate commentedI can also confirmed the same,I will work on this issue.
Comment #7
atul_ghate commentedThe issue was due to the wrong order of parameters being passed to the samePagePreviewRenderPreview JavaScript function. In version 2.1.3, the code used: $response->addCommand(new InvokeCommand(NULL, 'samePagePreviewRenderPreview', [$entity->uuid()]));
However, in version 2.1.4, an additional NULL parameter was added: $response->addCommand(new InvokeCommand(NULL, 'samePagePreviewRenderPreview', [NULL, $entity->uuid()]));
This caused the JavaScript function to receive NULL for the UUID, resulting in it not working correctly. By correcting the order of the parameters, the issue was resolved. i have aslo confirmed that view mode is working as well.
Comment #8
iancawthorne commentedI can confirm the patch at #6 resolves the issue for me.
Comment #9
atul_ghate commentedComment #10
dishakatariya commentedHi, I have verified this issue with the #6 patch applied successfully on D11 version.
Testing Steps:
1. Goto your local D11 version.
2. Install the module.
3. Go to the admoin/content
4. Add content and check Preview only works when editing content, not creating.
Test Results:
Now the preview works during creating the node as well.
Attached the Before and After Screenshots as well.
Hence moving to RTBC
RTBC+1
Comment #13
cosmicdreams commentedThank you, merged.
Comment #14
atul_ghate commentedHi @cosmicdreams ,
Thanks for merging the MR.
I noticed that I wasn't credited for resolving this issue. Could you let me know if there's something I might have missed?
Comment #15
cosmicdreams commentedComment #16
cosmicdreams commentedI don't think you did anything wrong. Much of what governs this system is automated. From what I can see you have been credited
Comment #17
atul_ghate commentedYes, now I have been credited. Thank you, @cosmicdreams
Comment #19
jonloh commentedLooks like it's not working again on Drupal 10.3.6 with new content, as shown in the screencast here.
Only works well when I edit content.
Comment #20
jonloh commentedReverting the code from patch #6 seems to resolve the issue for Drupal 10.3.6.
It looks like we may need to create a separate version specifically for Drupal 10 to ensure compatibility.
Comment #21
yevko commentedThis change is not being pulled when the last version of the module is installed.
Comment #22
yevko commentedConfirming the https://www.drupal.org/project/same_page_preview/issues/3462436#comment-... for 11.1.3!