-
Notifications
You must be signed in to change notification settings - Fork 31
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
PLAT-109381: Reduce the ImageItem render time #2790
Open
ybsung
wants to merge
29
commits into
develop
Choose a base branch
from
feature/PLAT-109381
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 28 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
4634186
Initial commit
ybsung 5f99477
Fix lint and cleanup
ybsung db8b9bd
Fix unit tests and lints
ybsung 272ab5c
Remove console.log
ybsung 5fff0a7
Cleanup comments
ybsung a4719be
Skip some unit tests
ybsung d986def
Simplify code
ybsung ae68a14
Simplify code
ybsung 0509950
Fix
ybsung 0177f50
Fix
ybsung 598a8c2
Cleanup
ybsung e3b81ca
Pass MemoPropsContext as a prop
ybsung f20cea8
Merge branch 'develop' into feature/PLAT-109381
ybsung 8873ec8
Revert "Pass MemoPropsContext as a prop"
ybsung 0661aea
Apply MemoPropsChildrenContext
ybsung 3baca33
Cleanup
ybsung d393911
Apply custom useContext
ybsung 980ad86
Cleanup
ybsung 086479d
Renaming
ybsung 363305f
Cleanup
ybsung 60ec1ca
Fix lint
ybsung d678b62
Fix lint
ybsung 3b3891b
Renaming in MemoPropsDecorator
ybsung 2979896
Cleanup
ybsung 53c0c4b
Fix JS Doc and comment
ybsung 911c814
Fix
ybsung 6fd8dee
Define MemoPropsThemeDecorator
ybsung 2819f44
Fix
ybsung da1c155
Fix JSDoc
ybsung 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
This file contains 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 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 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,61 @@ | ||
import hoc from '@enact/core/hoc'; | ||
import pick from 'ramda/src/pick'; | ||
import omit from 'ramda/src/omit'; | ||
import React from 'react'; | ||
|
||
const MemoPropsThemeContext = React.createContext(); | ||
const MemoPropsContext = React.createContext(); | ||
|
||
const defaultConfig = { | ||
filter: [] | ||
}; | ||
|
||
const MemoPropsDecorator = hoc(defaultConfig, (config, Wrapped) => { | ||
const {filter} = config; | ||
|
||
// eslint-disable-next-line no-shadow | ||
function MemoPropsDecorator (props) { | ||
const picked = pick(filter, props) || {}; | ||
const omitted = omit(filter, props) || {}; | ||
|
||
return ( | ||
<MemoPropsContext.Provider value={picked}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will force the component to update every time it receives props, even if the values are exactly the same, because the object has changed and context will force the update. Some form of memoization should be done if this truly is the desired solution. |
||
<Wrapped {...omitted} /> | ||
</MemoPropsContext.Provider> | ||
); | ||
} | ||
|
||
return MemoPropsDecorator; | ||
}); | ||
|
||
const MemoPropsThemeDecorator = hoc((config, Wrapped) => { | ||
// eslint-disable-next-line no-shadow | ||
function MemoPropsThemeDecorator (props) { | ||
return ( | ||
<MemoPropsThemeContext.Provider value={props}> | ||
<Wrapped {...props} /> | ||
</MemoPropsThemeContext.Provider> | ||
); | ||
} | ||
|
||
return MemoPropsThemeDecorator; | ||
}); | ||
|
||
const ContextConsumer = (Context) => (fn) => { // eslint-disable-line enact/display-name | ||
return ( | ||
<Context.Consumer> | ||
{fn} | ||
</Context.Consumer> | ||
); | ||
}; | ||
|
||
const MemoPropsContextConsumer = ContextConsumer(MemoPropsContext); | ||
const MemoPropsThemeContextConsumer = ContextConsumer(MemoPropsThemeContext); | ||
|
||
export default MemoPropsThemeContext; | ||
export { | ||
MemoPropsContextConsumer, | ||
MemoPropsDecorator, | ||
MemoPropsThemeContextConsumer, | ||
MemoPropsThemeDecorator | ||
}; |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to delete
css
, I believe it's non-enumerable.