Skip to content

WIP feat: access namespaced getters using the dot notation #1364

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

Open
wants to merge 5 commits into
base: 3.x
Choose a base branch
from

Conversation

hootlex
Copy link
Member

@hootlex hootlex commented Aug 3, 2018

Add's support for accessing namespaced getters using the dot notation, the same way we do for the state. For example: this.$store.getters.users.newUsers

Implements #1258

Todo:

@hootlex
Copy link
Member Author

hootlex commented Aug 3, 2018

cc @kazupon @ktsn @simplesmiler

@chearon
Copy link

chearon commented Aug 22, 2018

Would love to see this merged. It also closes #679. I implemented dotted getters in a patch I posted there before I knew about this!

@chearon
Copy link

chearon commented Sep 6, 2018

Any chance the slashed getters could be removed entirely in favor of just the nested structure? It would be a breaking change I guess, but it looks way nicer in the debugger to not have both of them. I've implemented it that way here.

@hootlex
Copy link
Member Author

hootlex commented Sep 7, 2018

@chearon I don't think dropping the slashed getters is a good idea. It is a breaking change and I am sure many people prefer that syntax over the dot notation.

It's more likely that we introduce slashed state to provide a consistent API among Vuex assets.

@mittalyashu
Copy link

Any updates on this PR?

@pickfire
Copy link

@hootlex Would it be nice to discuss on dropping the slash getters for vue 3.0 in the rfc? This could avoid confusion later on such that the getters are more consistent with the others for namespacing.

@sustained
Copy link

sustained commented Feb 28, 2019

WRT removing slashed getters, as I mentioned in this issue, what'd be wrong with just deprecating them?

So, if you were to write .getters['foo/bar'] then you'd get something along the lines of console.warn('Deprecation notice: Slashed getters will be removed in X version - use dotted notation.').

I think adding slashed state too is a bad idea, foo.bar.baz will always be way nicer than foo['bar/baz'] on the eyes. But perhaps I'm alone in thinking this.

@yanni4night
Copy link
Contributor

Is there any plan to merge this PR, or any alternative solution to fix this?

@graberzz
Copy link

Hello everyone, my dear friend Vasily really wants this feature to be merged, resolve ASAP

@sustained
Copy link

It's been nearly a year since this PR was made and it hasn't even been discussed by a single member of the Vuex team let alone merged. 😦

@Mr-Markus
Copy link

I agree with everyone who says that without dot notation it is difficult to read.

It seems that work is already done, but why is it not merged? 😦

@caseydwyer
Copy link

Any updates on this being merged, @hootlex?

@jmcudk
Copy link

jmcudk commented Oct 22, 2019

+1 This would be a really nice feature

@ilyakamens
Copy link

I'd also like for this to be merged.

@Jutanium
Copy link

Would love to see this merged. Happy to edit/write documentation if that would help.

@J5Dev
Copy link

J5Dev commented Jul 22, 2020

I would also love to see this make it in, especially after about the 1000th time of forgetting and just instinctively writing in dot, just to have to go back and fix it all again after the wall of errors.

@no-stack-dub-sack
Copy link

Adding to this in hopes it will get revisited and merged!

@kiaking kiaking added enhancement New feature or request and removed proposal labels Oct 4, 2021
@cuebit cuebit deleted the branch vuejs:3.x April 13, 2022 03:12
@cuebit cuebit closed this Apr 13, 2022
@cuebit cuebit reopened this Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.