Skip to content

Editor: Run block-editor's setup before editor's so that settings are available for parse-time validation.#16489

Closed
epiqueras wants to merge 1 commit intomasterfrom
fix/validation-failing-because-of-wrong-editor-setup-order
Closed

Editor: Run block-editor's setup before editor's so that settings are available for parse-time validation.#16489
epiqueras wants to merge 1 commit intomasterfrom
fix/validation-failing-because-of-wrong-editor-setup-order

Conversation

@epiqueras
Copy link
Copy Markdown
Contributor

Fixes #16429

Description

Validation runs during parsing when EditorProvider is constructed, but needs to use settings, e.g. colors, which are first set when BlockEditorProvider is mounted.

Either moving validation out of the parsing step or moving EditorProvider constructor setup side effects into componentDidMount would fix this (because componentDidMount runs children => parent).

We should do the latter anyways, in preparation for the next version of React, so this PR takes that route.

How has this been tested?

It was verified that a page with a pullquote block using the primary color from settings is no longer failing validation.

Types of Changes

Bug Fix: Setup editor and block-editor in the right order so that settings like colors are available during parse-time block validation.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

@epiqueras epiqueras added [Type] Bug An existing feature does not function as intended [Package] Editor /packages/editor labels Jul 9, 2019
@epiqueras epiqueras added this to the Gutenberg 6.2 milestone Jul 9, 2019
@epiqueras epiqueras self-assigned this Jul 9, 2019
@epiqueras epiqueras force-pushed the fix/validation-failing-because-of-wrong-editor-setup-order branch from 6ae631d to 1ca56ca Compare July 24, 2019 21:52
@gziolo gziolo removed this from the Gutenberg 6.2 milestone Jul 30, 2019
Copy link
Copy Markdown
Contributor

@draganescu draganescu left a comment

Choose a reason for hiding this comment

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

Works as described, code is good :)

@epiqueras
Copy link
Copy Markdown
Contributor Author

Tests are failing a lot though.

@epiqueras
Copy link
Copy Markdown
Contributor Author

Closing this as the issue was resolved by making blocks pure functions of their attributes.

@epiqueras epiqueras closed this Nov 20, 2019
@youknowriad youknowriad deleted the fix/validation-failing-because-of-wrong-editor-setup-order branch November 21, 2019 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Editor /packages/editor [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pullquote with color causes invalid content bug

3 participants