Skip to content

Conversation

@dzearing
Copy link
Member

@dzearing dzearing commented Jul 27, 2018

Addresses #5691 and #5413.

We were observing some peculiarities with theme changing. Addressed multiple issues here:

  1. We now use react16 context rather than the deprecated context for customizer. We think there may have been issues in the old context model wrt pure components not propagating context changes to children, but now I'm not completely sure. Nevertheless, less deprecated api usage is good.

  2. Check shouldComponentupdate was too restrictive and didn't consider mutations to theme or classname. Adjusting logic fixed some theming issues we saw.

  3. When loadTheme is called to apply a global theme, we were not observing mutations to this, so Customizers wouldn't re-evaluate and re-render. We now do observe global theme changes and rerender.

  4. Minor tweak to webpack config.

All customizer tests still pass, and DetailsList now respects

Microsoft Reviewers: Open in CodeFlow

this.props.className !== newProps.className ||
this.props.checked !== newProps.checked ||
this.props.theme !== newProps.theme
);
Copy link
Member

Choose a reason for hiding this comment

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

What if styles prop changes? I feel like having shouldComponentUpdate for such a simple component is code smell and we're checking most of the props now. I'm curious why it exists at all

return (
// tslint:disable-next-line:no-any
<ComposedComponent {...defaultProps} {...this.props as any} />
<CustomizerContext.Consumer>
Copy link
Member

Choose a reason for hiding this comment

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

👍 I can steal this for createComponent 😄

@dzearing dzearing assigned cliffkoh and JasonGore and unassigned cliffkoh Jul 27, 2018
Copy link
Contributor

@cliffkoh cliffkoh left a comment

Choose a reason for hiding this comment

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

Will do a more thorough review on Monday

"react": ">=16.3.2-0 <17.0.0",
"react-dom": ">=16.3.2-0 <17.0.0",
"typescript": "2.8.4",
"typescript": "3.0.0-rc",
Copy link
Contributor

Choose a reason for hiding this comment

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

?

@dzearing
Copy link
Member Author

Looks like I may be blocked on this getting published in enzyme-adapter-react-16.

enzymejs/enzyme#1620

@cliffkoh cliffkoh dismissed their stale review August 2, 2018 01:56

Stale review

@cliffkoh
Copy link
Contributor

cliffkoh commented Aug 2, 2018

I think you have created a separate PR to get a smaller subset of this PR in, while the rest of the changes are blocked on enzyme fixing a bug...

I will close this then until you can actually make progress on it.

@cliffkoh cliffkoh closed this Aug 2, 2018
@dzearing dzearing reopened this Aug 14, 2018
…c-react into customizer-fix

# Conflicts:
#	packages/office-ui-fabric-react/src/components/Check/Check.base.tsx
#	packages/utilities/src/Customizer.tsx
#	packages/utilities/src/customizable.tsx
…c-react into customizer-fix

# Conflicts:
#	packages/utilities/src/Customizer.tsx
@JasonGore JasonGore mentioned this pull request Aug 15, 2018
9 tasks
scope: string,
context: TContext
) => IStyleableComponentCombinedProps<TViewProps, TStyleSet, TTheme>;
CustomizerContext: React.Context<TContext>;
Copy link
Member

Choose a reason for hiding this comment

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

👍

TViewProps,
TStyleSet,
TTheme
>;
Copy link
Member

Choose a reason for hiding this comment

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

I feel like this cast shouldn't be needed since you've defined a return type for getCustomizations in IStylingProviders...

@dzearing dzearing merged commit e4daa37 into microsoft:master Aug 22, 2018
@dzearing dzearing deleted the customizer-fix branch August 22, 2018 18:00
JasonGore added a commit that referenced this pull request Sep 7, 2018
* Moving Customizer to new React context.j

* adding change files.

* reversing change.

* Update package.json

* Fixing merge issue.

* Dropdown fixes.

* Fixes for foundation.

* Oops

* adding changes.
@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants