Skip to content
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

How to do a Recursive Schema Definition #67

Open
stoefln opened this issue Jan 2, 2019 · 0 comments
Open

How to do a Recursive Schema Definition #67

stoefln opened this issue Jan 2, 2019 · 0 comments

Comments

@stoefln
Copy link

stoefln commented Jan 2, 2019

I am having issues hydrating a store which contains a tree data structure consisting of TreeNode objects. The problem is that the instances get hydrated as objects instead of TreeNodes. My guess is (after reading #25) that I can't use a class definition for persist within the class itself.

Thats my TreeNode class:

export default class TreeNode {
   
    @persist id = Math.random();
    @persist @observable title = "Root";
    @persist @observable collapsed = false; // if node should be shown opened
    @persist('list', TreeNode) @observable childNodes  = []; // <- should this work?
    ...

Can you help me with this?

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

No branches or pull requests

1 participant