question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support of $bind with nested key path

See original GitHub issue

I intend to $bind a collection of documents under docs by id. It seems to work, and wonder if it is supported officially.

const documents = db.collection('documents')

export default {
  props: ['documentId'],
  data: () => ({ docs: { }}),
},
  watch: {
    documentId(id) {
      // $bind automatically unbinds the previously bound property
      this.$bind(`docs.${id}`, documents.doc(id))
    },
  },
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
andrewspycommented, Sep 27, 2019

@posva Thanks for the pointer, I manage to get it working with:

const documents = db.collection('documents')

export default {
  props: ['documentId'],
  data: () => ({ docs: { }}),
},
  watch: {
    documentId(id) {
      // $set manually for reactivity to work
      this.$set(this.docs, id, null)
      this.$bind(`docs.${id}`, documents.doc(id))
    },
  },
}

I noticed that when binding this way, $bind always return undefined instead of Promise<Object> as per documentation.

I would also propose having a topic on “Dynamic binding with Vue.set” in the documentation as this is common use-case.

0reactions
posvacommented, Sep 27, 2019

Added to the roadmap #145 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

WPF: How to bind to a nested property? - Stack Overflow
Easiest way would be to set the DataContext after you've initialized in the code behind rather than in XAML. That makes sense because...
Read more >
Go.Binding and nested properties - GoJS - Northwoods Software
Hi Does go.Binding support binding to nested properties such as new go.Binding("text", "queryResult.value")? Currently, in order to produce ...
Read more >
Bind to nested properties - Unity - Manual
This example demonstrates how to use the binding-path attribute of a BindableElement in UXML to bind fields to nested properties of a SerializedObject....
Read more >
Bind to nested (navigation) properties in complex objects
How do I use complex objects in my model and show nested (navigation) properties information in the grid? Solution. Set the Field parameter...
Read more >
Binding with nested objects is not working properly
This code snippets were working with the older version, but not with the new one. The selected item will not be set properly....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found