-
Notifications
You must be signed in to change notification settings - Fork 2.9k
DetailsList's GroupSpacer: Refactor to React.SFC & remove styled HOC to improve render performance #8435
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
Merged
dzearing
merged 10 commits into
microsoft:master
from
KevinTCoughlin:keco/conditionally-render-groupspacer
Mar 22, 2019
Merged
DetailsList's GroupSpacer: Refactor to React.SFC & remove styled HOC to improve render performance #8435
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
580bb08
Conditionally render GroupSpacer
KevinTCoughlin bb8e63e
Refactor complex conditional render GroupSpacer to method
KevinTCoughlin 0024f84
Refactor GroupSpacer to React.SFC & remove styled HOC
KevinTCoughlin 1e03d97
Revert "Refactor complex conditional render GroupSpacer to method"
KevinTCoughlin 727ab04
Revert "Conditionally render GroupSpacer"
KevinTCoughlin b489fc1
Add deprecations to GroupSpacer style props
KevinTCoughlin a5d7f94
Update API file
KevinTCoughlin f7b55a1
Update snapshot
KevinTCoughlin b0783a8
Change file
KevinTCoughlin 60d640e
Use ReturnType for GroupSpacer return type
KevinTCoughlin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
...hanges/office-ui-fabric-react/keco-conditionally-render-groupspacer_2019-03-22-05-43.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "packageName": "office-ui-fabric-react", | ||
| "comment": "GroupSpacer: Reduce render calls by refactoring styled HOC to React.SFC", | ||
| "type": "minor" | ||
| } | ||
| ], | ||
| "packageName": "office-ui-fabric-react", | ||
| "email": "[email protected]" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
packages/office-ui-fabric-react/src/components/GroupedList/GroupSpacer.styles.ts
This file was deleted.
Oops, something went wrong.
24 changes: 6 additions & 18 deletions
24
packages/office-ui-fabric-react/src/components/GroupedList/GroupSpacer.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,11 @@ | ||
| import * as React from 'react'; | ||
| import { styled, classNamesFunction } from '../../Utilities'; | ||
| import { IGroupSpacerProps, IGroupSpacerStyleProps, IGroupSpacerStyles } from './GroupSpacer.types'; | ||
| import { getStyles } from './GroupSpacer.styles'; | ||
|
|
||
| const getClassNames = classNamesFunction<IGroupSpacerStyleProps, IGroupSpacerStyles>(); | ||
| import { IGroupSpacerProps } from './GroupSpacer.types'; | ||
|
|
||
| export const SPACER_WIDTH = 32; | ||
|
|
||
| export const GroupSpacer = styled<IGroupSpacerProps, IGroupSpacerStyleProps, IGroupSpacerStyles>( | ||
| (props: IGroupSpacerProps) => { | ||
| const { count, styles, theme, indentWidth = SPACER_WIDTH } = props; | ||
| const classNames = getClassNames(styles, { | ||
| theme: theme!, | ||
| width: count * indentWidth | ||
| }); | ||
| export const GroupSpacer: React.SFC<IGroupSpacerProps> = (props: IGroupSpacerProps): ReturnType<React.SFC<IGroupSpacerProps>> => { | ||
| const { count, indentWidth = SPACER_WIDTH } = props; | ||
| const width = count * indentWidth; | ||
|
|
||
| return count > 0 ? <span className={classNames.root} /> : null; | ||
| }, | ||
| getStyles, | ||
| undefined, | ||
| { scope: 'GroupSpacer' } | ||
| ); | ||
| return count > 0 ? <span className={'ms-GroupSpacer'} style={{ display: 'inline-block', width }} /> : null; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.