{"action":"created","issue":{"url":"https://api.github.com/repos/vuejs/vuex/issues/441","repository_url":"https://api.github.com/repos/vuejs/vuex","labels_url":"https://api.github.com/repos/vuejs/vuex/issues/441/labels{/name}","comments_url":"https://api.github.com/repos/vuejs/vuex/issues/441/comments","events_url":"https://api.github.com/repos/vuejs/vuex/issues/441/events","html_url":"https://github.com/vuejs/vuex/issues/441","id":187108656,"number":441,"title":"Vuex Relational Logic","user":{"login":"mcordingley","id":1084253,"avatar_url":"https://avatars.githubusercontent.com/u/1084253?v=3","gravatar_id":"","url":"https://api.github.com/users/mcordingley","html_url":"https://github.com/mcordingley","followers_url":"https://api.github.com/users/mcordingley/followers","following_url":"https://api.github.com/users/mcordingley/following{/other_user}","gists_url":"https://api.github.com/users/mcordingley/gists{/gist_id}","starred_url":"https://api.github.com/users/mcordingley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcordingley/subscriptions","organizations_url":"https://api.github.com/users/mcordingley/orgs","repos_url":"https://api.github.com/users/mcordingley/repos","events_url":"https://api.github.com/users/mcordingley/events{/privacy}","received_events_url":"https://api.github.com/users/mcordingley/received_events","type":"User","site_admin":false},"labels":[{"id":326099948,"url":"https://api.github.com/repos/vuejs/vuex/labels/discussion","name":"discussion","color":"d4c5f9","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-03T16:03:35Z","updated_at":"2016-11-04T15:58:18Z","closed_at":null,"body":"I have a project where I need to build up and dynamically manage relations between my Vue models. I have [a rough working model](https://gist.github.com/mcordingley/3f9322be2f33ea8ed0a90f0bcbd2141b) implemented outside of Vuex, but would like to formalize it, hammer out greater usability and features, and integrate it into Vuex so others can make use of it, be it as a plug-in or integrated into the base.\r\n\r\nHow should I proceed with building this? And, is anyone else interested in helping me to work out the kinks in it? JavaScript feels more like a second language to me, so the help of someone who works more extensively in it would help expedite the process.\r\n\r\nMy thoughts with regard to what I've built and where it needs to be:\r\n\r\n- The code works by creating a map of id to object for each registered object type that it uses to look up related models whenever a model gets added or updated. It then sets a direct reference to that related object and registers itself in an array on the related object to make the relationship two way. Unfortunately, this does preclude relationship types that are one-to-one or many-to-many.\r\n- Vuex, like Vue, doesn't mandate much about how the data appears. This does. That may be a problem and it'd be nice to move to a more data-agnostic approach, though the notion of unique identifiers cannot go away entirely.\r\n- The code as it stands cannot handle when one type of object has multiple relations to another type of object. This is currently a blocker on one of my projects.\r\n- A very-nice-to-have is for the code that resolves a related object to make use of Promises and user-supplied callbacks to fetch a local copy of the related object if it exists in the store and fall back to the potentially asynchronous callback to fetch the missing object."},"comment":{"url":"https://api.github.com/repos/vuejs/vuex/issues/comments/258471540","html_url":"https://github.com/vuejs/vuex/issues/441#issuecomment-258471540","issue_url":"https://api.github.com/repos/vuejs/vuex/issues/441","id":258471540,"user":{"login":"ktsn","id":2194624,"avatar_url":"https://avatars.githubusercontent.com/u/2194624?v=3","gravatar_id":"","url":"https://api.github.com/users/ktsn","html_url":"https://github.com/ktsn","followers_url":"https://api.github.com/users/ktsn/followers","following_url":"https://api.github.com/users/ktsn/following{/other_user}","gists_url":"https://api.github.com/users/ktsn/gists{/gist_id}","starred_url":"https://api.github.com/users/ktsn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktsn/subscriptions","organizations_url":"https://api.github.com/users/ktsn/orgs","repos_url":"https://api.github.com/users/ktsn/repos","events_url":"https://api.github.com/users/ktsn/events{/privacy}","received_events_url":"https://api.github.com/users/ktsn/received_events","type":"User","site_admin":false},"created_at":"2016-11-04T15:58:18Z","updated_at":"2016-11-04T15:58:18Z","body":"Hi, @mcordingley. Thank you for your interest in this project.\r\n\r\nJust clarify, what problem are you facing concretely? As you said, Vuex does not have concern for data model itself so much but manages data flow. So, I think you can loosely couple your store and Vuex somehow. For example, actions can query or save data related to each Vuex module like ajax request with `RelationalStore`."}}
{"actor":{"display_login":"ktsn"}}