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

persist ID as string shows NaN #172

Open
shidcordero opened this issue Jan 27, 2021 · 2 comments
Open

persist ID as string shows NaN #172

shidcordero opened this issue Jan 27, 2021 · 2 comments

Comments

@shidcordero
Copy link

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
@shidcordero shidcordero changed the title persist ID as string shows NaN #707 persist ID as string shows NaN Jan 27, 2021
@Dotrox
Copy link

Dotrox commented Feb 2, 2021

I think it because of toPrimaryKey method which used on id from server response.

See my issue: #173

@shidcordero
Copy link
Author

so I ended up creating a path file for plugin-graphql and remove the Guid formatting and leave it just a string.

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

2 participants