Skip to content

Writing Flow: Guard against falsey block container#4941

Merged
aduth merged 1 commit intomasterfrom
fix/writing-flow-container
Feb 8, 2018
Merged

Writing Flow: Guard against falsey block container#4941
aduth merged 1 commit intomasterfrom
fix/writing-flow-container

Conversation

@aduth
Copy link
Copy Markdown
Member

@aduth aduth commented Feb 7, 2018

This pull request seeks to resolve an application error which can occur when pasting some content into a Columns block.

Implementation notes:

It seems our WritingFlow behaviors assumes that all other block rendering has flushed by the time componentDidUpdate is called. While I'm yet unclear what it is about nested blocks that breaks this expectation (i.e. error'ing only in Columns), I don't think that we should not be relying on this behavior unless it's explicitly documented somewhere to occur this way (renders occurring upward from children through to ancestors).

Testing instructions:

Copy content from the following Google Doc:

https://docs.google.com/document/d/1z4B4WT3KI11AhQS29iKDBNeoqrjmDpFCNYzZLKr_Oy4/edit?usp=sharing

Paste into a column of the Columns block.

Verify that no errors occur.

@aduth aduth added [Type] Bug An existing feature does not function as intended [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... labels Feb 7, 2018
@aduth aduth requested a review from ellatrix February 7, 2018 22:51
@ellatrix
Copy link
Copy Markdown
Member

ellatrix commented Feb 7, 2018

While I'm yet unclear what it is about nested blocks that breaks this expectation (i.e. error'ing only in Columns)

The check seems good in any case. I'm also looking around a bit to figure out what is happening, because with this PR the block fails to get focus (unlike outside columns). Which is already an improvement from an error of course. I see that the UID is correct and it is present in the DOM as a child of the container. Unsure why it fails to select. Is there a delay happening here?

Copy link
Copy Markdown
Member

@ellatrix ellatrix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good temporary fix, but we'll have to figure out why the block won't focus.

@aduth
Copy link
Copy Markdown
Member Author

aduth commented Feb 7, 2018

The main issue is that the rendering occurs in the reverse order as what is expected: WritingFlow's componentDidUpdate fires, and only afterward the contents of the nested BlockList. This despite, from what I can tell, there being no asynchronous updates, and state already having been updated to reflect the newly replaced blocks.

@aduth aduth merged commit d9a6655 into master Feb 8, 2018
@aduth aduth deleted the fix/writing-flow-container branch February 8, 2018 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants