Skip to content
This repository was archived by the owner on Feb 6, 2023. It is now read-only.

Commit a6c9ffd

Browse files
steveluscherfacebook-github-bot
authored andcommitted
Inline call to gkx to combat fatal in ContentState
Summary: ngavalas has a theory that timing is causing this to fatal – the GK map might not have been primed yet by the time the `gkx` check is made in the //module body//. The solution herein is to inline the check. The hope is that the GK map will always be primed by the time you go to check the GK. Reviewed By: ngavalas Differential Revision: D9316479 fbshipit-source-id: 49bb592328e76ffbe6c2d85a3db55a12e0f9dd80
1 parent 9130859 commit a6c9ffd

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/model/immutable/ContentState.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ const sanitizeDraftText = require('sanitizeDraftText');
3232

3333
const {List, Record, Repeat} = Immutable;
3434

35-
const experimentalTreeDataSupport = gkx('draft_tree_data_support');
36-
3735
const defaultRecord: {
3836
entityMap: ?any,
3937
blockMap: ?BlockMap,
@@ -46,10 +44,6 @@ const defaultRecord: {
4644
selectionAfter: null,
4745
};
4846

49-
const ContentBlockNodeRecord = experimentalTreeDataSupport
50-
? ContentBlockNode
51-
: ContentBlock;
52-
5347
const ContentStateRecord = Record(defaultRecord);
5448

5549
class ContentState extends ContentStateRecord {
@@ -196,6 +190,9 @@ class ContentState extends ContentStateRecord {
196190
const strings = text.split(delimiter);
197191
const blocks = strings.map(block => {
198192
block = sanitizeDraftText(block);
193+
const ContentBlockNodeRecord = gkx('draft_tree_data_support')
194+
? ContentBlockNode
195+
: ContentBlock;
199196
return new ContentBlockNodeRecord({
200197
key: generateRandomKey(),
201198
text: block,

0 commit comments

Comments
 (0)