-
Notifications
You must be signed in to change notification settings - Fork 989
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
perf[react-native]: Memoized Blocks Component to free up UI thread. #3814
Merged
+194
−38
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e264c12
perf(Blocks): Memoized the Blocks Components for freeing the UI thread
03baae3
fix(test): added condition for checking rn sdk in symbols test case
315c3a1
Merge branch 'BuilderIO:main' into perf-react-native
yash-builder 81a7a82
fix: merge conflicts
bb5b126
fix(Block): Memoized block component
ec013d4
feat: Added changelog
5533720
fix: 'major' to 'patch'
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
fix: merge conflicts
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
96 changes: 0 additions & 96 deletions
96
packages/sdks/overrides/react-native/src/components/blocks/blocks.tsx
This file was deleted.
Oops, something went wrong.
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.
Initially in this PR, you were memoizing
Block
, but now you're memoizingBlocks
instead.Was this intended? Do we still get the same performance benefits from memoizing the parent component instead of the individual items?
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.
Hey Sami, In the earlier PR also we were memoizing
Blocks.tsx
and notBlock.tsx
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.
Ah indeed, you memoized
Blocks.tsx
in your original PR commit.but you were also creating a memoized version of Block called RenderBlock : https://github.com/BuilderIO/builder/pull/3814/commits/e264c120fd38851208875a9915b55e26e952528f#diff-b9cbe94aa51d49deda0[…]fd13d38a1f56e5641441f5R20
Which is now gone from this PR. Was it unnecessary?
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.
Ah my bad I missed this part. Also one question I want to ask by using mitosis how can I write code outside the
Blocks
function but inside theBlocks.tsx
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.
in my Loom I explan that in this case, you probably want to add
export default Memo(Block)
toBlock.tsx
, and remove thisRenderBlock
fromBlocks.tsx
to achieve the same outcomeThere 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.
gotcha!
Asking out of curiosity. Is there a way where we can declare variables/functions outside Functional/Class component using
mitosis.config.js
?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.
Yes actually, there's a
preComponent
hook in Mitosis whose code will be printed right after import statements (and therefore, outside React components)