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.
The editor has encountered an unexpected error. and wasn’t able to add or edit posts.
During the upgrade Gutenberg editor was enabled so on disabling that It resolved the issue for now.