Skip to content

Move state transformation from proxy wrapper to proxy-state-tree hook#641

Merged
henri-hulski merged 1 commit intonextfrom
transformPath
Dec 5, 2025
Merged

Move state transformation from proxy wrapper to proxy-state-tree hook#641
henri-hulski merged 1 commit intonextfrom
transformPath

Conversation

@henri-hulski
Copy link
Copy Markdown
Member

Fixes #638 by reimplementing namespace scoping at a lower level within
proxy-state-tree instead of wrapping state with an additional proxy layer.

The initial implementation used createScopedProxy which worked for actions
and effects but caused incorrect nested state mutations due to adding an
extra proxy layer on top of proxy-state-tree's existing proxies.

Changes in proxy-state-tree:

  • Added transformPath hook to IOptions interface for path transformation
  • Implemented resolveTransformedPath() in Proxifier to resolve transformed paths
  • Modified createObjectProxy to apply transformations during property access
  • Ensured proper method binding for transformed class instances (StateMachine)

Changes in Overmind:

  • Removed createScopedProxy for state (kept for actions/effects)
  • Implemented transformPath option in createProxyStateTree configuration
  • Added execution context tracking to provide namespace information to transformPath
  • Modified createAction to track currentExecution for async actions

This approach eliminates the extra proxy layer while maintaining namespace
scoping functionality, allowing state.user.status mutations to work correctly
in namespaced modules.

… hook

Moves state transformation logic from an external proxy wrapper into proxy-state-tree's internal
proxy mechanism.

ISSUES CLOSED: #638
@codesandbox
Copy link
Copy Markdown

codesandbox Bot commented Dec 5, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@henri-hulski henri-hulski merged commit 6e6a123 into next Dec 5, 2025
8 checks passed
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.

[BUG] Scoped Namespace determination breaks earlier code with nested state

1 participant