Skip to content

For single instance cannot set isDirty: false using update (vuex-orm-core .36.3 and change-flags 1.2.3) #12

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

Closed
vikaskedia opened this issue Jul 9, 2020 · 1 comment

Comments

@vikaskedia
Copy link

The code I am running is:

  console.log("trying to set isdirty false")
  ormRem.update({
    data: { 
      uuid: item.uuid,
      '$isDirty': false, 
    },
    preventDirtyFlag: true
  }).then(result => {
    console.log('update result: ', result)
  })
})

The output I get is:

image

The definition of model is at:
https://github.com/savantcare/ptfile/blob/master/ptclient/components/rem/vuex-orm/model.js

import { Model } from '@vuex-orm/core'
const { v1: uuidv1 } = require('uuid')

export default class reminders extends Model {
  // This is the name used as module name of the Vuex Store.
  static entity = 'rem'

  static primaryKey = 'uuid' // Ref: https://vuex-orm.org/guide/model/defining-models.html#primary-key

  // List of all fields (schema) of the post model. `this.attr` is used
  // for the generic field type. The argument is the default value.
  static fields() {
    return {
      uuid: this.uid(() => uuidv1()),
      uuidOfRemMadeFor: this.attr(null),
      remDescription: this.attr(null),
      notes: this.attr(null),
      priority: this.number(0),
      isAutoRem: this.number(0),
      recordChangedByUUID: this.attr(null),
      recordChangedFromIPAddress: this.attr(null),
      recordChangedFromSection: this.attr(null),
      // Why store time as a number? Since vuex-orm does not understand dates.
      // The data types that vuex-orm understands are given at: https://vuex-orm.org/guide/model/defining-models.html#generic-type
      ROW_START: this.number(0),
      ROW_END: this.number(0),
    }
  }
}

Is this a bug?

@vikaskedia
Copy link
Author

Duplicate of #9 (comment)

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

1 participant