Skip to content
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

fix(utils): useProxy to avoid re-renders when no props are touched #809

Merged
merged 2 commits into from
Nov 28, 2023

Conversation

dai-shi
Copy link
Member

@dai-shi dai-shi commented Nov 5, 2023

Related Issues or Discussions

Fixes #808 (comment)

Summary

Touch a dummy prop so that it avoids re-renders if no other props are touched.
I'm not sure if we should add this hack, or just add a caveat note in docs.

Check List

  • yarn run prettier for formatting code and docs

Copy link

vercel bot commented Nov 5, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
valtio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 5, 2023 9:51am

Copy link

codesandbox-ci bot commented Nov 5, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit e4c8324:

Sandbox Source
React Configuration
React TypeScript Configuration
React Browserify Configuration
React Snowpack Configuration
React Parcel Configuration

Copy link

github-actions bot commented Nov 5, 2023

Size Change: +163 B (0%)

Total Size: 51.4 kB

Filename Size Change
dist/esm/react/utils.js 258 B +33 B (+15%) ⚠️
dist/react/utils.js 277 B +33 B (+14%) ⚠️
dist/system/react/utils.development.js 356 B +35 B (+11%) ⚠️
dist/system/react/utils.production.js 237 B +14 B (+6%) 🔍
dist/umd/react/utils.development.js 433 B +33 B (+8%) 🔍
dist/umd/react/utils.production.js 314 B +15 B (+5%) 🔍
ℹ️ View Unchanged
Filename Size
dist/esm/index.js 62 B
dist/esm/macro.js 698 B
dist/esm/macro/vite.js 864 B
dist/esm/react.js 732 B
dist/esm/utils.js 68 B
dist/esm/vanilla.js 2.44 kB
dist/esm/vanilla/utils.js 3.07 kB
dist/index.js 243 B
dist/macro.js 919 B
dist/macro/vite.js 1.08 kB
dist/react.js 668 B
dist/system/index.development.js 236 B
dist/system/index.production.js 170 B
dist/system/macro.development.js 779 B
dist/system/macro.production.js 556 B
dist/system/macro/vite.development.js 951 B
dist/system/macro/vite.production.js 660 B
dist/system/react.development.js 871 B
dist/system/react.production.js 471 B
dist/system/utils.development.js 241 B
dist/system/utils.production.js 176 B
dist/system/vanilla.development.js 2.58 kB
dist/system/vanilla.production.js 1.52 kB
dist/system/vanilla/utils.development.js 3.28 kB
dist/system/vanilla/utils.production.js 2.19 kB
dist/umd/index.development.js 382 B
dist/umd/index.production.js 330 B
dist/umd/macro.development.js 1.03 kB
dist/umd/macro.production.js 721 B
dist/umd/macro/vite.development.js 1.23 kB
dist/umd/macro/vite.production.js 879 B
dist/umd/react.development.js 814 B
dist/umd/react.production.js 526 B
dist/umd/utils.development.js 398 B
dist/umd/utils.production.js 344 B
dist/umd/vanilla.development.js 2.76 kB
dist/umd/vanilla.production.js 1.64 kB
dist/umd/vanilla/utils.development.js 3.86 kB
dist/umd/vanilla/utils.production.js 2.46 kB
dist/utils.js 247 B
dist/vanilla.js 2.63 kB
dist/vanilla/utils.js 3.71 kB

compressed-size-action

@dai-shi
Copy link
Member Author

dai-shi commented Nov 25, 2023

I think this change is probably reasonable, because useProxy only takes care of top level property access.

@dai-shi dai-shi marked this pull request as ready for review November 25, 2023 03:18
@dai-shi dai-shi merged commit 01672d9 into main Nov 28, 2023
31 checks passed
@dai-shi dai-shi deleted the fix/issue-808 branch November 28, 2023 00:52
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.

1 participant