Closed pastelmind closed 1 year ago
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 | Jul 20, 2023 2:44am |
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 577e63ebe2ce9db908fa0add0b40ad92dedb93bb:
Sandbox | Source |
---|---|
React | Configuration |
React Typescript | Configuration |
React Browserify | Configuration |
React Snowpack | Configuration |
React Parcel | Configuration |
https://github.com/pmndrs/valtio/actions/runs/5537152975/jobs/10105667717?pr=760
Size Change: +1.33 kB (+2%)
Total Size: 58.6 kB
Filename | Size | Change | |
---|---|---|---|
dist/esm/vanilla.js |
2.59 kB | +170 B (+7%) | đ |
dist/system/vanilla.development.js |
2.74 kB | +171 B (+7%) | đ |
dist/system/vanilla.production.js |
1.61 kB | +104 B (+7%) | đ |
dist/umd/vanilla.development.js |
3.08 kB | +343 B (+13%) | â ī¸ |
dist/umd/vanilla.production.js |
1.83 kB | +201 B (+12%) | â ī¸ |
dist/vanilla.js |
2.95 kB | +342 B (+13%) | â ī¸ |
I think it's good. Thanks for the suggestion.
I would like to refactor to make "treat it like a [[set]] trap" clear. Let me add some commits.
While investigating #764, I learned that the [[Set]]
internal method invokes [[DefineOwnProperty]]
when the property does not exist or is a data property. This means that each property assignment triggers both the set
and defineProperty
traps of the proxy--potentially calling notifyUpdate()
twice (unless the property is a setter).
Perhaps I was too hasty in reusing the set
trap logic for the defineProperty
trap? It would be semantically correct to create a separate Op
for defineProperty
.
potentially calling notifyUpdate() twice
would it be possible to reproduce it in tests?
Related Issues or Discussions
Fixes #759 (the feature request at the end)
Summary
Adds support for ES2022 class fields created with
Object.defineProperty()
semantics. When a configurable, enumerable, and writable (CEW) own property (usually a class field) is created on a proxy object that does not have the property, or has a CEW own property of the same name, treat it like a [[set]] trap.Check List
yarn run prettier
for formatting code and docs