File upload breaks when there are unsaved changes in parent model.

  • 1
  • Problem
  • Updated 3 years ago
  • In Progress


Note that all the images shows are my baby (Violet is due in July), so I'm not violating any HIPAA laws. :)
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Anna Wiersema

Anna Wiersema

  • 10,890 Points 10k badge 2x thumb
*Like*   (I like that this is a picture of your daughter, not that the file upload is breaking).

I've also had trouble with the file upload when creating/cloning a record (when the parent hasn't been saved yet) but am not sure whether this is a bug thing or "there's a reason this happens but it's frustrating" thing.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Thanks, Anna.

If it's the latter, I can work-around with a model action that saves on changes, but I'd rather avoid that if it's not necessary.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Matt,  this is quasi-intentional behavior.  What is failing is the attachment model refresh needed to show your recently uploaded picture.  In most cases when there are unsaved changes on a model you are not able to perform actions that force a requery.  For example,  filters and search boxes are disabled when unsaved changes are detected. We don't want to assume that you want to save the made changes to the database,  yet need to perform a requery in order to complete the action.

What I would reccomend is adding some conditional rendering to your file attachment component so the component is not shown when unsaved changes are detected.

Also.  (Safe Harbor here)  in our next release we will be allowing conditional disabiling,  which would allow you to keep the component visible, but not let users interact with it when changes were detected.   I think that will be the best solution here.  
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Thanks, Rob! That makes sense.

Really looking forward to that release...