Skip to content

persist ID as string shows NaN #172

@shidcordero

Description

@shidcordero

Describe the bug

when id type is string, it shows NaN after persist

Steps to reproduce the bug

i have this model

import { Model as ORMModel } from '@vuex-orm/core'
import Model from './Model'

export default class Make extends ORMModel {
  static entity = 'makes'
  static eagerLoad = ['models']

  static fields() {
    return {
      id: this.string(),
      name: this.string(null).nullable(),
      active: this.boolean(true),
      models: this.hasMany(Model, 'makeId')
    }
  }
}

I use fireorm as database and everytime the model transform and inserted in vuex-orm store. it shows NaN. see console.log output:

image

Expected behaviour

Should allow id as string type and save correct id value.

Versions

  • Vuex ORM: 0.36.3
  • I am using Nuxt: 2.14.12

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