pmndrs / valtio

🧙 Valtio makes proxy-state simple for React and Vanilla
https://valtio.dev
MIT License
8.84k stars 248 forks source link

fix(vanilla): improve performance with configurable property on snapshot #664

Closed dai-shi closed 1 year ago

dai-shi commented 1 year ago

and some refactors.

close #519 again.

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗ī¸Ž

Name Status Preview Comments Updated
valtio ✅ Ready (Inspect) Visit Preview đŸ’Ŧ Add your feedback Feb 14, 2023 at 1:53AM (UTC)
codesandbox-ci[bot] commented 1 year ago

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 269d75a20c35cfc768143955b987e0d4e9d013ac:

Sandbox Source
React Configuration
React Typescript Configuration
React Browserify Configuration
React Snowpack Configuration
React Parcel Configuration
form-test-jotai Issue #519
form-test-zustand Issue #519
form-test-valtio Issue #519
github-actions[bot] commented 1 year ago

Size Change: +590 B (+1%)

Total Size: 56 kB

Filename Size Change
dist/esm/react.js 732 B +22 B (+3%)
dist/esm/vanilla.js 2.42 kB +106 B (+5%) 🔍
dist/react.js 668 B +16 B (+2%)
dist/system/react.development.js 871 B +20 B (+2%)
dist/system/react.production.js 471 B +5 B (+1%)
dist/system/vanilla.development.js 2.56 kB +114 B (+5%) 🔍
dist/system/vanilla.production.js 1.49 kB +3 B (0%)
dist/umd/react.development.js 812 B +15 B (+2%)
dist/umd/react.production.js 524 B +5 B (+1%)
dist/umd/vanilla.development.js 2.71 kB +111 B (+4%)
dist/umd/vanilla.production.js 1.6 kB +63 B (+4%)
dist/vanilla.js 2.6 kB +110 B (+4%)
ℹī¸ 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/utils.js` | 221 B | | `dist/esm/utils.js` | 68 B | | `dist/esm/vanilla/utils.js` | 4.21 kB | | `dist/index.js` | 232 B | | `dist/macro.js` | 937 B | | `dist/macro/vite.js` | 1.09 kB | | `dist/react/utils.js` | 237 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/utils.development.js` | 316 B | | `dist/system/react/utils.production.js` | 221 B | | `dist/system/utils.development.js` | 241 B | | `dist/system/utils.production.js` | 176 B | | `dist/system/vanilla/utils.development.js` | 4.43 kB | | `dist/system/vanilla/utils.production.js` | 2.84 kB | | `dist/umd/index.development.js` | 372 B | | `dist/umd/index.production.js` | 322 B | | `dist/umd/macro.development.js` | 1.05 kB | | `dist/umd/macro.production.js` | 724 B | | `dist/umd/macro/vite.development.js` | 1.23 kB | | `dist/umd/macro/vite.production.js` | 882 B | | `dist/umd/react/utils.development.js` | 396 B | | `dist/umd/react/utils.production.js` | 297 B | | `dist/umd/utils.development.js` | 386 B | | `dist/umd/utils.production.js` | 333 B | | `dist/umd/vanilla/utils.development.js` | 4.7 kB | | `dist/umd/vanilla/utils.production.js` | 2.92 kB | | `dist/utils.js` | 236 B | | `dist/vanilla/utils.js` | 4.54 kB |

compressed-size-action

dai-shi commented 1 year ago

Finally fixed! https://codesandbox.io/s/form-test-valtio-forked-85ozhn?file=/src/App.tsx

dai-shi commented 1 year ago

I liked the assert-again-getUntracked idea b/c it would be more black-box and assert what we really care about (compare-proxy isn't making copies)

@stephenh Can you help with the idea of black-box tests? (Open a PR?)

Merging this for now.