Skip to content

Error occured if trying to call a method on an object with prototype provided as payload #953

@liqueurdetoile

Description

@liqueurdetoile

Version

5.0.6

Browser and OS info

Chrome 73.0.3683.86 / Windows 10

Steps to reproduce

  1. Create an object with a method defined in its prototype
  2. Use it as payload for a commit
  3. Try to use this method inside mutation callback

See this sandbox for a repro built on class syntactic sugar (I've also added a custom non enumerable property for testing purposes and the property also vanished in vue-devtools payload) : https://codesandbox.io/s/v0x463v235

What is expected?

The prototype (and likely all non enumerable properties) should be available on committed object in payload. It works fine with Vuex and should work fine with vue-devtools as well.

What is actually happening?

It seems vue-devtools only keep enumerable properties of the payload object instead of using the whole object (maybe due to some partial cloning ?).

Therefore, the mutation triggers a not a function TypeError when trying to load state from vue-devtools after the commit


I'm using a kind of ORM with class instances.

This issue may be related to #935 and #945

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions