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

Vue devtools still broke application #1126

Closed
xar opened this issue May 16, 2019 · 6 comments
Closed

Vue devtools still broke application #1126

xar opened this issue May 16, 2019 · 6 comments

Comments

@xar
Copy link

xar commented May 16, 2019

Case

Vue devtools still broke application with rxdb.

Issue

With rxdb 8.1 with vue dev tools enabled I still get error. This time bit different:

TypeError: Cannot read property 'getValue' of undefined
    at Object.get _data [as _data] (rx-document.js?8769:36)
    at Object.get (rx-document.js?8769:182)
    at Object.eval [as id] (rx-document.js?8769:440)
export var basePrototype = {
  /**
   * because of the prototype-merge,
   * we can not use the native instanceof operator
   */
  get isInstanceOfRxDocument() {
    return true;
  },

  get _data() {
    return this._dataSync$.getValue(); <-
  },

I'm really not sure why dataSync$ is undefined.

Info

  • Browser
  • IndexedDB
  • Typescript, Vue
@xar xar changed the title Vue devtools still broke application with rxdb. Vue devtools still broke application May 16, 2019
@pubkey
Copy link
Owner

pubkey commented May 16, 2019

Vue is a hack by itself :)

@pubkey
Copy link
Owner

pubkey commented May 18, 2019

@xar does the error occur when you add the document to the vue-state or before that?

@PeterKnight
Copy link

My Vue related errors went away when I switched to feeding Vue instances raw values from RxDB based queries using JSON.parse() and stringify() instead. That way you don't have two tools trying to make your data reactive. It might even be best practice?

@pubkey
Copy link
Owner

pubkey commented May 20, 2019

@PeterKnight yes, using plain objects inside of a components state is recommended by me, because it makes it easier to debug problems. A RxDocument mutates itself over time, so when you add it and find a bug, you can not be sure what state the document had at this point of time.

Note that you can call myRxDocument.toJSON() to get a plain object-representation of the document. Then you do not have to call JSON.parse() and stringify().

But this is still a bug and adding RxDocuments to the vue-state should work. I will try to fix.

@pubkey pubkey closed this as completed in 942445e May 20, 2019
@pubkey
Copy link
Owner

pubkey commented May 20, 2019

pubkey added a commit that referenced this issue May 20, 2019
@pubkey
Copy link
Owner

pubkey commented May 20, 2019

I added a better fix and tested it with vue devtools.
I still do not know why this bug appears. I think the current implementation of the prototype-merging is overly complicated. We should refactor it in the future and then can better fix it.

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

3 participants