Just putting this out there for others who upgraded to WordPress 5.4 and got this error.
The only solution I could find was related to an editor and clearing cache, but I couldn’t fix it through Astra Theme or Elementor Settings.
Problem:
The editor has encountered an unexpected error. and wasn’t able to add or edit posts.
Resolution:
During the upgrade Gutenberg editor was enabled so on disabling that It resolved the issue for now.
About Me
I hope this helps someone else, I’m on Instagram or twitter if you want to come say hi.