-
Notifications
You must be signed in to change notification settings - Fork 2
Arbor OST #146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Variables referencing OST nodes should be prefixed with '$' to indicate they are reactive, e.g. mutations triggered on them will trigger the subscription system to notify subscribers.
Detached properties do not exist in the OST, thus, when changes are made to them subscribers of the OST are not notified.
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a new internal data structure called Observable State Tree (OST) to better streamline Arbor's internals. The key changes involve refactoring from a path-based system to a seed-based system and creating a new modular handler architecture.
- Replaces the existing
Seed.plant()method with a newplantSeedFor()approach - Implements a comprehensive OST architecture with handlers for different data types
- Adds extensive test coverage for the new OST implementation
Reviewed Changes
Copilot reviewed 106 out of 113 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/arbor-store/src/arbor.ts | Refactors seed management to use WeakMap-based tracking and new plantSeedFor method |
| packages/arbor-store/src/handlers/default.ts | Updates to use new tree-based seed planting approach |
| packages/arbor-store/tests/arbor.test.ts | Adds it.only to focus testing on state tree updates |
| packages/arbor-ost/ | New OST package with complete implementation including handlers, visitors, and comprehensive test suite |
| Various config files | Updates to project configuration including TypeScript version and tooling |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| visit({ ost, target, $node }) { | ||
| return (...args: unknown[]) => { | ||
| let unshifted: unknown[] |
Copilot
AI
Sep 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unshift method returns a number (the new length), but the variable is typed as unknown[]. The assignment should be unshifted = target.unshift(...args) and the return type should be number.
| let unshifted: unknown[] | |
| let unshifted: number |
| visit({ ost, target, $node }) { | ||
| return () => { | ||
| if (target.size === 0) { | ||
| return false |
Copilot
AI
Sep 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The clear method should return void like the native Map.clear(), not a boolean. Remove the return statements or return undefined.
| } | ||
| }) | ||
|
|
||
| return true |
Copilot
AI
Sep 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The clear method should return void like the native Map.clear(), not a boolean. Remove the return statements or return undefined.
| this.#seeds.set(value, new Seed()) | ||
| } | ||
|
|
||
| return this.#seeds.get(value) |
Copilot
AI
Sep 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method creates a new seed but doesn't return it. The logic should return the newly created seed: if (!seed) { const newSeed = new Seed(); this.#seeds.set(value, newSeed); return newSeed; }
| this.#seeds.set(value, new Seed()) | |
| } | |
| return this.#seeds.get(value) | |
| const newSeed = new Seed(); | |
| this.#seeds.set(value, newSeed); | |
| return newSeed; | |
| } | |
| return seed; |
| thisArg?: unknown | ||
| ) { | ||
| for (const [key] of target.entries()) { | ||
| cb($node.get(key), key, thisArg || $node) |
Copilot
AI
Sep 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The third parameter should be the map itself, not thisArg. The call should be cb.call(thisArg, $node.get(key), key, $node).
| cb($node.get(key), key, thisArg || $node) | |
| cb.call(thisArg, $node.get(key), key, $node) |
Implement a new internal data structure called Observable State Tree to better streamline Arbor's internals.