Repository navigation
fix(svelte-table, vue-table): forward delete and defineProperty in live context proxy - #6684
sivaraman-krishnan wants to merge 2 commits into
Conversation
…ve context proxy The live proxy behind useCellContext()/useHeaderContext() (shared by the Svelte and Vue adapters since TanStack#6633) forwarded assignment to the current cell or header but had no deleteProperty or defineProperty traps. delete reported success while leaving the property on the target, and Object.defineProperty wrote to the proxy's empty backing object, so later reads could be stale or throw a proxy-invariant TypeError. Forward both operations to the current target, passing descriptors through as a direct defineProperty on the cell would. Explicitly non-configurable definitions are rejected because the proxy reports every property as configurable and cannot keep that guarantee when the target changes. preventExtensions is refused for the same reason, so the backing object stays extensible and later definitions cannot mutate the target and then fail an invariant check. Fixes TanStack#6681 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9c8906e7-0320-4f31-b724-aba346882b96
🦋 Changeset detectedLatest commit: e6af46d The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…urable
Object.defineProperty(context, key, { value }) on a new key created a
non-configurable property on the cell or header (the JS default when
configurable is omitted), while the live proxy's getOwnPropertyDescriptor
reports every property as configurable. A later strict-mode delete then
threw "'deleteProperty' on proxy: trap returned falsish", and redefining
with the reported descriptor also threw.
Define new keys as configurable so the reported descriptor stays
truthful. Existing keys keep their own attributes, and explicitly
non-configurable definitions are still rejected.
Refs TanStack#6681
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9c8906e7-0320-4f31-b724-aba346882b96
🎯 Changes
Fixes #6681. The issue names Svelte, but the same
createLiveProxyhelper was added to both the Svelte and Vue adapters in #6633, so this fixes both copies.The proxy behind
useCellContext()/useHeaderContext()had nodeletePropertyordefinePropertytraps.delete context.customreturnedtruebut left the property on the cell.Object.defineProperty(context, …)wrote to the proxy's empty backing object, so later reads were stale or threw a proxy-invariantTypeError.deleteandObject.definePropertyare now forwarded to the current cell/header.Object.defineProperty(context, 'custom', { value })made a non-configurable property, and a later strict-modedeleteor redefinition threw. Existing properties keep their own attributes, andwritable/enumerableare passed through unchanged.configurable: falsedefinitions are rejected without changing the cell, since the proxy can't keep that guarantee when the target changes.Object.preventExtensionsis refused for the same reason: a proxy that can switch targets can't promise a fixed key set. The backing object stays extensible.preventExtensions, and unchanged get/set/has/ownKeys behavior.✅ Checklist
pnpm testandpnpm test:e2e, or these tests do not apply to this pull request.Locally I ran the unit tests, eslint, typecheck, build, publint, sherif and knip for
svelte-tableandvue-table(all passing); I wasn't able to run the fullpnpm test/pnpm test:e2ein my environment, so I've left that box unchecked.🚀 Release Impact
Summary by CodeRabbit