This repository has been archived by the owner on Aug 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
Media Player - Limit Unnecessary re-renders #3238
Merged
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0f93718
Prevent unnecessary re-renders
ryanmccombe 173e23a
Simplify code
ryanmccombe bcb5cbe
Version bump
ryanmccombe 1ea9c1c
Merge branch 'latest' into media-player-prevent-rerendering
ryanmccombe f7b2c61
Merge branch 'latest' into media-player-prevent-rerendering
ryanmccombe 277113d
Add wrapping function
ryanmccombe bec71e4
Remove wrapping function
ryanmccombe e596c08
Merge branch 'latest' into media-player-prevent-rerendering
FK78 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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.
This may be unnecessarily explicit, as I'm describing essentially what ramda equals does implicitly, but, for future readability - I'm not sure it's clear that equals is being passed prevProps and nextProps?
I quite like the model of passing a function
isEqual
as the second argument in the memo and then declaring the function along these lines: (though I realise === may always evaluate to false even if the objects are principally 'the same', so may need rearranging)I think this makes it clearer what's going on and maybe negates the need for adding comments?
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.
cheers 👍 added wrapping function
we still need the deep equality check as
===
just checks if the objects are the same instance, ie, the same place in memorythe bug we're dealing with is parent components creating an entirely new object and passing it down - but that object has all the same values as the previous one
different objects will fail the
===
check but, if they have the same content, they'll pass the ramdaequals
checkThere 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.
CI is failing because this wrapping function doesn't have test coverage 🤣
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.
-0.1% you naughty boy.