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

Getting parent of a reference (not a real node) #1284

Open
2 tasks done
terrysahaidak opened this issue May 13, 2019 · 2 comments
Open
2 tasks done

Getting parent of a reference (not a real node) #1284

terrysahaidak opened this issue May 13, 2019 · 2 comments
Labels
enhancement Possible enhancement

Comments

@terrysahaidak
Copy link

Question

  • I've checked the documentation and searched for existing issues
  • I tried the spectrum channel

I'm building an application with a lot of references to the same model. So I had to store it separately in some sort of entities store normalized. But it makes it impossible to fetch the parent from reference because both getParent and getParentOfType returns me the Entities store but not the store I'm referencing from.

Is it really possible to get the store which has a reference to my model?

Here is a little example:
https://codesandbox.io/s/ox183w4o75

@xaviergonz
Copy link
Contributor

Not at the moment unfortunately, since right now as soon as a reference is accessed what you get is actually the target node.

I created a few days ago a RFC to rethink the references API
#1282

I think that by using that API it would be possible, since then the references would not be "dereferenced" automatically

@xaviergonz xaviergonz added question Question or help request enhancement Possible enhancement and removed question Question or help request labels May 14, 2019
@terrysahaidak
Copy link
Author

Thanks, @xaviergonz, sounds really cool.

As a workaround currently I'm using recursive references - I'm adding a reference to my Application model pointing to Job model which has reference to that Application model. Sounds really bad, but at least it works. Looking forward to a new API - it's the only thing I'm missing right now from MST.

Both you and @mweststrate did great work with MST. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Possible enhancement
Projects
None yet
Development

No branches or pull requests

2 participants