Skip to content

Remove proxies#9

Merged
adebola-io merged 1 commit intomainfrom
remove-proxy
Feb 5, 2026
Merged

Remove proxies#9
adebola-io merged 1 commit intomainfrom
remove-proxy

Conversation

@adebola-io
Copy link
Owner

@adebola-io adebola-io commented Feb 5, 2026

This PR removes the automatic proxy-based reactivity system from SourceCell. Previously, when reading a value from a source cell via .get(), the returned value was wrapped in a Proxy that intercepted property access and mutations, allowing patterns like cell.get().a = 2 to trigger reactive updates. With the optional deep: true flag, this proxying extended recursively to nested properties.

This approach had several issues:

  • Surprising semantics — returning a proxy from .get() means the caller is never working with the actual value, which can cause subtle bugs with identity checks, serialization, and interop with external libraries.
  • Performance overhead — every .get() call created a new Proxy, and every property access on the returned object went through trap handlers, including instanceof checks against Map, Set, Date, Array, and ArrayBuffer views.
  • Implicit mutation model — intercepting mutations on the returned object conflates reading and writing, making data flow harder to reason about. Explicit .set() calls are clearer and more predictable.
  • Maintenance burden — the proxy logic required maintaining lists of mutative methods for Map, Set, Date, and Array, and each new collection type would need additional special-casing.

Changes

  • library/classes.js: Removed the #proxy() method from SourceCell, so .get() now returns the raw value directly. Removed the mutative method sets (mutativeMapMethods, mutativeSetMethods, mutativeArrayMethods, mutativeDateMethods) that supported the proxy logic. Removed the deep option from CellOptions and related JSDoc.
  • README.md: Removed documentation of the deep option from the source cell configuration example.
  • tests/index.test.js: Removed the entire Nested cells test suite and proxy-related cell option tests. Updated the deep equality test to no longer use the deep option or test mutation-through-get patterns.

Migration

Code that relied on mutating values through .get():

// Before
const cell = Cell.source({ a: 1 });
cell.get().a = 2; // implicitly triggered update

// After
const cell = Cell.source({ a: 1 });
cell.set({ ...cell.get(), a: 2 }); // explicit update

Code that used the deep option can simply remove it — the option no longer exists and will be ignored.

Summary by CodeRabbit

Release Notes

  • Removed Features
    • Removed deep reactivity support for cells; cells now only track top-level property changes. Nested object modifications will no longer trigger updates.

Remove the Proxy-based tracking of nested object mutations and
mutative method calls. The `deep` option is no longer supported, and
SourceCell now only triggers updates on top-level value changes.
@coderabbitai
Copy link

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

This PR removes deep reactivity capabilities from the library. The deep option is removed from Cell options, the SourceCell.get() implementation is simplified to return values directly without deep proxy traversal, and all corresponding tests for nested deep reactivity are deleted.

Changes

Cohort / File(s) Summary
Documentation
README.md
Removes documentation of the deep option from Cell.source constructor options.
Core Implementation
library/classes.js
Removes the deep property from CellOptions interface and simplifies SourceCell.get() to return the underlying revalued value directly, eliminating deep proxy traversal behavior.
Test Suite
tests/index.test.js
Removes all tests related to deep reactivity, including "Nested cells" test block, complex nested scenario validations, and deep vs. shallow proxy behavior tests. Modifies remaining tests to use default shallow behavior only.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 Deep roots are plucked away today,
Shallow paths now light the way,
Proxies fade to simple code,
Tests cascade down a cleaner road,
Simpler cells go hop and play! 🌿

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Remove proxies' accurately reflects the main objective of the PR, which is to remove Proxy-based reactivity from SourceCell. It is concise, clear, and directly summarizes the primary change.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch remove-proxy

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@adebola-io adebola-io merged commit 7e79459 into main Feb 5, 2026
1 of 2 checks passed
@adebola-io adebola-io deleted the remove-proxy branch February 5, 2026 20:59
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