Save Model action - smart save?

  • 1
  • Question
  • Updated 8 months ago
  • In Progress

Does the Save Model action in the action frame performs save when there are no changes to the model? Does Skuid ignore save when there are no changes?

I only want to perform the save when there are changes. Wonder if I need to use a custom snippet to specifically check if model.hasChanged and then perform the save. I will need to handle rollback in that custom snippet. So I prefer not to do that.

Can you please confirm?

Thanks!

Photo of jili@heidrick.com

jili@heidrick.com

  • 2,032 Points 2k badge 2x thumb

Posted 2 years ago

  • 1
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
I don't know the answer, but you could perform the save action on a model that doesn't have any changes and see if the modified date/time changes. If it changes, then it is saving the model, if it doesn't change then it is not saving the model
Photo of and thorough

and thorough

  • 736 Points 500 badge 2x thumb
I just checked and it appears that the save action only saves if there are model changes, which is exactly what I'd hoped.  If no changes, no save is performed and the record's last modified date does not change.  I'd also like confirmation that this is the intended, supported behavior.  If so, this means we can attempt to save many models on the page and the models without changes should get skipped, right?  That would be a lot better for performance and avoid having to check for changes, so I hope that's right!