This repository has been archived by the owner on Feb 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
catch errors when encoding entity map
Summary: We've had several reports of people's content failing to save in the Performance tool. The only error message we have is this (with no callstack, unfortunately): ``` Unknown DraftEntity key: undefined. ``` I poked around in the DraftJS code, and my guess is that this is due to some character having an entity key associated with it that for whatever reason does not appear in the entity map. This diff "fixes" the issue by not throwing an error in this situation. This is definitely not as good as figuring out the root cause of the entity mismatch, but it seems reasonable for `convertFromDraftStateToRaw` to work with slightly malformed input. Not sure if it's ok to use `FBLogger` in this code or not, but I saw another usage of it in `draft-js-contrib` here: diffusion/WWW/browse/master/html/shared/draft-js-contrib/matchers/getImplicitDateTimeMatches.js;1000956292$34 I could also just ignore the error, but the linter didn't like that ¯\_(ツ)_/¯ Reviewed By: niveditc Differential Revision: D16362778 fbshipit-source-id: 6e2a6041d1a02b412d94655c9b6224fee868748d
- Loading branch information
1 parent
db792ef
commit c0e911c
Showing
3 changed files
with
55 additions
and
14 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
src/model/encoding/__tests__/__snapshots__/convertFromDraftStateToRaw-test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters