Skip to content

v3.0.16

Choose a tag to compare

@Yiin Yiin released this 10 Nov 09:23
· 33 commits to main since this release

3.0.16 sends every object write that lands on the state, whatever the receiver, and makes writes on objects faster.

  • An object proxy now has a defineProperty trap, as array proxies have since 3.0.13. Object.defineProperty(state.obj, "a", { value: 1 }) is sent like state.obj.a = 1, and flags alone on a new key like a write of undefined. 3.0.15 changed the object and sent nothing.
  • A write through an outer proxy with a getPrototypeOf or getOwnPropertyDescriptor trap, such as a membrane, is sent once, like the same write on the proxy. 3.0.15 changed the object and sent nothing when the outer proxy had a getPrototypeOf trap. A setter reached through such a proxy follows the rule of the direct write.
  • Another proxy of the state as receiver, Reflect.set(state.a, "x", 1, state.b), gives b the write and sends set b.x. 3.0.15 changed the raw b and sent nothing.
  • A direct write to an object no longer passes the proxy as receiver, and the set trap no longer takes a fifth parameter: object writes are faster on Node and Bun.
  • An object proxy remembers an outer proxy for each own key whose write through it landed, and writes that key directly from then on: a write through an outer proxy costs less than in 3.0.14. An outer proxy whose defineProperty or getOwnPropertyDescriptor trap later answers differently for that key is outside the supported input; its set trap still runs on every write.

The upgrade guide has a 3.0.16 section. Every other write sends the same events as in 3.0.15.