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

Trigger another field validation error #723

Open
ashlite opened this issue Apr 16, 2021 · 4 comments
Open

Trigger another field validation error #723

ashlite opened this issue Apr 16, 2021 · 4 comments

Comments

@ashlite
Copy link

ashlite commented Apr 16, 2021

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

@lukejagodzinski
Copy link
Member

When you're creating issue on GH you should always create reproduction repository with just trimmed down version of your problem. Just the PublishGame method, publishedAt, isPublished and paramCounters fields.

@ashlite
Copy link
Author

ashlite commented Apr 20, 2021

@lukejagodzinski
Copy link
Member

It's not reproduction repository. You have to trim it down even more just to essentials to reproduce error

@ashlite
Copy link
Author

ashlite commented Apr 21, 2021

It is already the trimmed version, the problem page(default), db, and pubsub method. When I deleting more, it just producing more error than intended

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants