orchidsoftware / orchidsoftware/platform
Upload field component refresh page without saving results in trash files in storage
@tabuna is already working on this.
Since Aug 28, 2021.
- Dominant language
- PHP
- Stars
- 4.8k
- Forks
- 662
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 7
Description
Describe the bug
Upload field component instantly creates Attachments model and uploads file, without waiting for save function to run. As result, if you upload without running the save function and refresh the page, we have trash Attachments without having any Model relations. The main issue here is the Attachmentable model is made without an Attachmentable model relation.
To Reproduce
Steps to reproduce the behaviour:
- Upload a file, but don't run the save function.
- Refresh the page.
- upload component is empty but Attachment Model and uploaded files remain.
Expected behaviour
Expected to save and preview from browser storage instead of uploading and fetching from URL. The actual upload should be delayed till the save function is called, so that both the Attachment and the Attachmentable model are created.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [Windows 11]
- Browser [*]
- Version [*]
Smartphone (please complete the following information):
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
Server (please complete the following information):
- Platfrom Version: [10.^]
- Laravel Version: [8.0^]
- PHP Version: [8.0]
- Database: [MySql]
- Database Version: [8.2^]
Additional context
Storage is costly on AWS. So this bug can drive up server costs. due to the collection of files not related to any model.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.