-
Notifications
You must be signed in to change notification settings - Fork 20
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
bug with module inheritance #20
Comments
Looks like the actions are stored in the base class instead of the derived class, which definately is a problem for inheritance. I"ll take a look at it when I get the time. |
@gertqin Okay, that"s would be nice. I can"t wait, so I wrote my own decorators :D. Maybe upload to github soon |
The problem here is that vuex modules don’t have any concept of inheritance. For helper methods, we only call the inherited instances with the correct My idea to solve this is to make |
Why not either create a generic base class, or use a constructor? |
Hi. I sat down and implemented a fix. Basically the solution was very simple (after I figured out, what really is going on - which took some time): treat the keys of Beside the fix I did some version bumping, small improvements about readability and a bit refactoring around the mentioned loop. My question @bodograumann or @gertqin is: Would you like to have a pull request with the minimum fix (then I have to do some more work) or would you accept a pull request with all these things together (certainly split up in several commits)? |
Ok, I just send you a minimal fix. |
Hi seflue, sorry for my late reply! I have been busy with other stuff (parental leave :)), so I haven"t really been at a computer the last month. Thanks a lot for your help, I have taken a short look at it, and so far it looks good! Any improvements are welcome, including version bumping and refactoring/readability improvements (although this is somewhat subjective, so I might not agree with everything :p), so if it is not too much extra work for you, feel free to commit your other improvements, and I"ll take a look at it :) |
If you don"t mind, it would be the easiest for me and my colleagues, if you just merge the PR first and for further improvements I will create separate PRs. |
Fix inheritance for actions and mutations (#20)
@gertqin We should bump up the version to 1.1.3. I forgot that in my PR. |
Trying to use this module for share common logic
Found question #13 and it works, but with bug of initializing actions (and maybe mutations too)
And when I call
projects/getList
it calls method fromroads
.I think problem is here:
vuex-class-modules/src/actions.ts
Line 9 in 2dab4e7
Child classes inherit this
vuexModule.__actions
property, that"s why Roads" methods overwrite Projects" one.The text was updated successfully, but these errors were encountered: