New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue with dynamic content showing '{dynamiccontent = "undefined"}' after re-opening email #13612
base: 5.x
Are you sure you want to change the base?
Conversation
There is a 'remove' event that fires and removes the ID's from storage, when reopening a mail with a dynamic content block. The problem is in the repo for the preset for grapesjs which has this similar ticket that I think has the same root cause. My proposed PRs to update GrapesJS, and the dependent preset, also fixes that problem. |
I made a PR to resolve this issue via the grapesjs mautic preset, but it would be helpful if you could test that solution as part of my GrapesJSBuilder update PR, so we can merge the big update at once. |
I checked your PR, there's no conflict between both our fixes, just a check on another level. So I'm gonna leave it alone. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code itself makes sense: the previous setComponents
overrides the Components instead, which is less clean than removing them and adding them in.
I guess this avoids some kind of caching issue which caused the stored block id to be targetted? I'd be interested to hear what you think went wrong with the 'remove' event (I think there's a bug in how the event is handled/the data is collected by GrapesJS itself), but in any case, this works.
@LordRembo I don't believe there is anything wrong with the remove event. When we call setComponents, it triggers the remove event, which then removes the DynamicContent. My fix does not call those events when we set the components. Although I haven't tested this, I believe that the approach mentioned in the linked pull request will also work - mautic/grapesjs-preset-mautic#52 If your GrapesJS upgrade works, then we can also proceed with that. |
We'll see which gets merged first :D I think this one has the best chance because the change is small and easy to test. Hopefully it gets picked up and approved on Open source Friday |
One reason that we need this PR is that in the previous changes |
Hi folks, this would need to be based on the 5.x branch for it to be merged in 5.1 or later, as we won't have any more releases on the 5.0 branch. Can you rebase it @irfanhanfi ? |
926991f
to
2e4a0b4
Compare
I have rebased it. |
Thanks @irfanhanfi - looks like a conflict to fix then we should be able to test. |
… after re-opening email
2e4a0b4
to
d07cbc6
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 5.x #13612 +/- ##
=========================================
Coverage 61.39% 61.39%
Complexity 34034 34034
=========================================
Files 2240 2240
Lines 101714 101714
=========================================
+ Hits 62443 62444 +1
+ Misses 39271 39270 -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All looking good now
This issue fixes the issue mentioned here - #13431 (comment)
Description:
The code
this.editor.setComponents(components);
triggers some events internally, resulting in the removal of dynamic contents and displayingundefined
.Steps to reproduce -
Steps to test this PR: