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

Nested Binding #754

Closed
patrickcorrigan opened this issue May 18, 2020 · 1 comment
Closed

Nested Binding #754

patrickcorrigan opened this issue May 18, 2020 · 1 comment

Comments

@patrickcorrigan
Copy link

patrickcorrigan commented May 18, 2020

I'm building a comment system using Vuefire.
I'm trying to recursively resolve child comments.
It works one level deep for rending to the HTML but any more than that the reactive doesn't seem to update. I'm not sure if this is the correct way to do it. I'm trying to $bind to properties of an object I've already used $bind on. Is this possible? Here is my code. Note level isn't used yet but it was how I was going to limit the depth.

    async resolveChildComments(comments, level, template) {
      for (let idx = 0; idx < 1 && comments.length; idx++) {
        let comment = comments[idx];
        console.log('level', level, 'comment', comment, 'idx', idx, 'children', comment.children, template)
        const parent = db.collection('comments').doc(comment.id);
        await this.$bind(`${template}.${idx}.children`, db.collection('comments').where('parent', '==', parent).orderBy('rating', 'desc').orderBy('meta.createdAt', 'desc'));
        await this.resolveChildComments(comments[idx].children, level + 1, `${template}.${idx}.children`)
      }
    }


 await this.resolveChildComments(this.selectedPostComments, 0, 'selectedPostComments');
@posva
Copy link
Member

posva commented May 18, 2020

Duplicate of #153

@posva posva marked this as a duplicate of #153 May 18, 2020
@posva posva closed this as completed May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants