Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs-theme] add Example forceUpdate prop to disable that behavior #2699

Merged
merged 3 commits into from
Jul 23, 2018

Conversation

giladgray
Copy link
Contributor

@giladgray giladgray commented Jul 16, 2018

allow disabling forceUpdate behavior in Example frame as it interferes with non-React libraries.

@@ -114,6 +121,9 @@ export class Example extends React.PureComponent<IDocsExampleProps> {
}

public componentDidMount() {
if (this.props.forceUpdate === false) {
Copy link
Member

Choose a reason for hiding this comment

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

this is very unintuitive. What about using default props or destructuring with a default and if (!this.props.forceUpdate)?

// `forceUpdate` - The docs app suffers from a Flash of Unstyled Content
// that causes components to mis-measure themselves on first render.
// Delay initial render till the DOM loads with a requestAnimationFrame.
const { forceUpdate = true } = this.props;
Copy link
Member

Choose a reason for hiding this comment

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

prefer having defaults in one place (defaultProps since you're using it twice)

@blueprint-bot
Copy link

Example defaultProps

Preview: documentation | landing | table

@giladgray giladgray merged commit c6d0b3a into develop Jul 23, 2018
@giladgray giladgray deleted the gg/example-force-update branch July 23, 2018 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants