Problem/Motivation
When attempting to add some paragraphs to a page we get an ajax error thrown with the following error:
Call to a member function getEntityTypeId() on null in Drupal\mercury_editor\Cache\MercuryEditorPreviewCacheContext->getContext() (line 41 of /app/docroot/modules/contrib/mercury_editor/src/Cache/MercuryEditorPreviewCacheContext.php).
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | Screenshot 2025-05-01 at 1.22.34 PM.png | 61.09 KB | pbabin |
| context_ajax_error.mp4 | 1.4 MB | johntarling |
Issue fork mercury_editor-3508661
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:
- 3508661-ajax-error-when
changes, plain diff MR !112
- 2.2.x
changes, plain diff MR !106
Comments
Comment #7
johntarling commentedCreated a quick fix for this by just checking that the entity is available before fetching the UUID.
Comment #9
pbabin commentedWe ran into this issue as well on our site - specifically it was occurring on paragraphs that included entity references.
Applied patch and issue is resolved for us.
Comment #10
joelsteidl commentedI can confirm that the patch fixed things for me as well.
My paragraph had an entity reference, so that checks out for consistency.
Comment #11
pixelwhip commentedComment #15
pixelwhip commentedThanks for this fix. I've rerolled this change on the latest form 2.2.x and merged it in.
Comment #16
pixelwhip commentedReleased in version 2.2.3