Skip to content

Trigger another field validation error #723

@ashlite

Description

@ashlite
PublishGame(){
      oldData = this.isPublished
      this.isPublished = !oldData
      if (this.isPublished){
        this.publishedAt = new Date()
      }
      return this.save()
    }

I have that method in astronomy. It uses to update isPublished and publishedAt fields in my data. Another field I have is paramCounters that are array objects and any other field. But when I run it, I have a validation array error in paramCounters validation field. The weird thing is that I don’t call and update that field in the above method. Anyone know why?

This is where I call the method. I have another function with this.remove() method and it works normally.

export function ListGameItem({gameData}){
  const [isOpen, setIsOpen] = useState(false)
  const onClose = () => setIsOpen(false)
  const cancelRef = useRef()
  const game = Game.findOne({_id:gameData._id})
  const history = useHistory()
  
  function HandlePublish(){
    console.log(game)
    game.callMethod('PublishGame', (err,result) => {
      err && alert(err.message)
      res && console.log(result)
    })
  }

  function HandleDeleteGame(){
    game.callMethod('DeleteGame', (err, result) => {})
    onClose()
  }

My latest repo is in https://github.com/ashlite/back-chamber
Thank you

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions