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

Decorators for compatability with vuex-module-decorators #292

Open
tommyo opened this issue Jun 20, 2019 · 7 comments
Open

Decorators for compatability with vuex-module-decorators #292

tommyo opened this issue Jun 20, 2019 · 7 comments

Comments

@tommyo
Copy link

@tommyo tommyo commented Jun 20, 2019

Would be great if we could do things like:

@Module
export default class Collection extends VuexModule {
  
  documents = [];

  @FirestoreAction
  bindCollection({ context }, name: string) {
    context.bindFirestoreRef('documents', db.collection(name));
    context.unbindFirestoreRef('documents');
  }
}

Would allow actions and state to be more true to how they look in Vanilla Vuex while also making them typesafe.

@posva
Copy link
Member

@posva posva commented Jun 22, 2019

vuex-module-decorators not being an official library, I don't want to directly expose the decorator on vuefire, instead we could add a page to the cookbook docs explaining how to do

@tommyo
Copy link
Author

@tommyo tommyo commented Aug 28, 2019

Now that I think about it, I agree - it doesn't belong in this package. I wrote a very simple vuexfire-decorators as a separate package. I'll release it as soon as it's hardened.

when combined with vuex-module-decorators and typescript, your todo example (as a module) looks like:

@Module
export default class TodoState extends VuexModule {

  public todos: Todo[] = [];

  @FirestoreBind('todos')
  public bindTodosRef() {
    return db.collection('todos');
  }
}
@garyo
Copy link

@garyo garyo commented Sep 18, 2019

I'd like to see how this is done -- @tommyo any chance you could release this or at least show a workaround?

@mjcadz
Copy link

@mjcadz mjcadz commented Oct 3, 2019

@tommyo I would also like to see this

@TomKaltz
Copy link

@TomKaltz TomKaltz commented Nov 29, 2019

@tommyo same here!

@liamrosenfeld
Copy link

@liamrosenfeld liamrosenfeld commented Dec 26, 2019

@tommyo, even if the workaround isn't hardened yet, sharing a loose version to implement in the meantime would be really helpful.

@mrzdevcore
Copy link

@mrzdevcore mrzdevcore commented Mar 21, 2020

@tommyo, can you share a link on how did you implement the decorator firestorebind ? Even if it is not ready for productio yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants
You can’t perform that action at this time.