Skip to content

Conversation

@duncannz
Copy link
Contributor

@duncannz duncannz commented Oct 6, 2023

Motivation

We found that the return value of makeStyles was changing on every render, which impacts performance, and makes it impossible to use it as a dependency of useMemo etc. without getting a "maximum update depth exceeded" error.

This change resolves this issue by ensuring the empty object literal used when no props are given is created inside the useMemo.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Jest Unit Test
  • Checked with example app

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation using yarn docs-build-api
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Additional context

@codecov
Copy link

codecov bot commented Jan 29, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (cec04af) 79.71% compared to head (55295d2) 79.68%.

Files Patch % Lines
packages/themed/src/config/makeStyles.ts 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next    #3844      +/-   ##
==========================================
- Coverage   79.71%   79.68%   -0.04%     
==========================================
  Files          87       87              
  Lines        1844     1846       +2     
  Branches      821      803      -18     
==========================================
+ Hits         1470     1471       +1     
- Misses        369      370       +1     
  Partials        5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@arpitBhalla arpitBhalla merged commit 52056de into react-native-elements:next Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants