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

Commit

Permalink
Inline call to gkx to combat fatal in ContentState
Browse files Browse the repository at this point in the history
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
  • Loading branch information
steveluscher authored and facebook-github-bot committed Aug 16, 2018
1 parent 9130859 commit a6c9ffd
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/model/immutable/ContentState.js
Expand Up @@ -32,8 +32,6 @@ const sanitizeDraftText = require('sanitizeDraftText');

const {List, Record, Repeat} = Immutable;

const experimentalTreeDataSupport = gkx('draft_tree_data_support');

const defaultRecord: {
entityMap: ?any,
blockMap: ?BlockMap,
Expand All @@ -46,10 +44,6 @@ const defaultRecord: {
selectionAfter: null,
};

const ContentBlockNodeRecord = experimentalTreeDataSupport
? ContentBlockNode
: ContentBlock;

const ContentStateRecord = Record(defaultRecord);

class ContentState extends ContentStateRecord {
Expand Down Expand Up @@ -196,6 +190,9 @@ class ContentState extends ContentStateRecord {
const strings = text.split(delimiter);
const blocks = strings.map(block => {
block = sanitizeDraftText(block);
const ContentBlockNodeRecord = gkx('draft_tree_data_support')
? ContentBlockNode
: ContentBlock;
return new ContentBlockNodeRecord({
key: generateRandomKey(),
text: block,
Expand Down

0 comments on commit a6c9ffd

Please sign in to comment.