Skip to content

Missing related polymorphic model on store entities after data transformation #129

@yoelpc4

Description

@yoelpc4

Describe the bug

I have User, Institute, and Activity model with morph many relationship as follow:

  1. User morph many actions
  2. User morph many activities
  3. Institute morph many activities

and inverse morph many relationship as follow:

  1. Activity morph to causer
  2. Activity morph to subject

The purpose of activity model is to logging activities (create, update, soft delete, restore, or force delete) of another model also the causer of the activity itself. In simple terms we can assume that:

  1. User causes actions as a causer of an Activity
  2. User activities are recorded as a subject of an Activity
  3. Institute activities are recorded as a subject of an Activity

I'm using JSON:API as API framework, in order to makes JSON:API response compatible with Vuex ORM data I'm using json-api-response-converter as response transformer package.

I don't know why at data transformation it works well, but when at data retrieval it gives id, type, and model morph to with null value.

Steps to reproduce the bug

  1. Visit the reproduction link

  2. When we check the console log of data transformation L:20, the subject is exists on activity 7672 also both causer and subject are exists on activity 7934.

  3. At the same time when we check the console log of data retrieval console log L:36, the subject is null from activity 7672 also both causer and subject are null from activity 7934.

Expected behavior

Persisted data with related polymorphic on vuex store entities is conformed to transformed data with related polymorphic.

Versions

  • Vuex ORM Axios: 0.9.3
  • Vuex ORM: 0.36.3
  • json-api-response-converter: 1.6.0

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