Skip to content

Nested Binding #754

@patrickcorrigan

Description

@patrickcorrigan

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');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions