-
Notifications
You must be signed in to change notification settings - Fork 2k
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
@uppy/core: do not crash if a file is removed before the upload starts #4148
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think it's better to align with our existing patterns and remove all of this in favor of a single if (uppy.getFile(fileId) === null) return undefined
hasBeenRemoved
is a super temporary state, it's just to mutate a file quickly enough to realize it elsewhere, but afterwards the whole file will be gone, making it "removed" already.
packages/@uppy/core/src/Uppy.js
Outdated
@@ -181,8 +181,8 @@ class Uppy { | |||
/** | |||
* Shorthand to set state for a specific file. | |||
*/ | |||
setFileState (fileID, state) { | |||
if (!this.getState().files[fileID]) { | |||
setFileState (fileID, state, checkIfFileExist = true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I'd take a single extra negligible computation over adding a new parameter to a function. Will there every be a case outside this? Is it worth making a function more complex?
| Package | Version | Package | Version | | ---------------------- | ------- | ---------------------- | ------- | | @uppy/angular | 0.3.3 | @uppy/tus | 2.4.5 | | @uppy/aws-s3 | 2.2.3 | uppy | 2.13.7 | | @uppy/golden-retriever | 2.1.3 | | | - @uppy/core: do not crash if a file is removed before the upload starts (Antoine du Hamel / #4148) - @uppy/xhr-upload: fix `Timed out waiting for socket` (Antoine du Hamel / #4150) - @uppy/golden-retriever: Fix retry upload with Golden Retriever (Merlijn Vos / #4155) - @uppy/aws-s3: fix `Cannot mark a queued request as done` in `MiniXHRUpload` (Antoine du Hamel / #4151) - @uppy/angular: remove unnecessary `console.log` call (Antoine du Hamel / #4139)
| Package | Version | Package | Version | | ---------------------- | ------- | ---------------------- | ------- | | @uppy/angular | 0.4.3 | @uppy/tus | 3.0.3 | | @uppy/aws-s3 | 3.0.3 | @uppy/url | 3.1.0 | | @uppy/companion | 4.0.4 | @uppy/webcam | 3.2.1 | | @uppy/core | 3.0.3 | @uppy/xhr-upload | 3.0.3 | | @uppy/golden-retriever | 3.0.2 | uppy | 3.2.0 | | @uppy/locales | 3.0.2 | | | - @uppy/webcam: fix bug when Dashboard is using a custom id (Antoine du Hamel / #4099) - @uppy/url: refactor `UrlUI` (Antoine du Hamel / #4143) - @uppy/url: trim whitespace around user input (Andrew McIntee / #4143) - @uppy/core: do not crash if a file is removed before the upload starts (Antoine du Hamel / #4148) - @uppy/xhr-upload: fix `Timed out waiting for socket` (Antoine du Hamel / #4150) - @uppy/golden-retriever: Fix retry upload with Golden Retriever (Merlijn Vos / #4155) - @uppy/aws-s3,@uppy/xhr-upload: fix `Cannot mark a queued request as done` in `MiniXHRUpload` (Antoine du Hamel / #4151) - meta: add a CI check to validate `yarn.lock` (Antoine du Hamel / #4154) - meta: fix outdated `yarn.lock` (Antoine du Hamel / #4153) - meta: fix `transloadit-xhr` dev example (Antoine du Hamel / #4149) - meta: Add example for Uppy with S3 and a Node.js server (Raúl Ibáñez / #4129) - @uppy/locales: Fix duplicate keys in UK_UA.js (Murderlon) - @uppy/companion: add workaround for S3 accelerated endpoints (Mikael Finstad / #4140) - @uppy/locales: Add missing Ukrainian locale entries (Andrii Bodnar / #4145) - @uppy/angular: remove unnecessary `console.log` call (Antoine du Hamel / #4139) - meta: fix bundlers workflow (Antoine du Hamel / #4144) - meta: fix default sources (Mikael Finstad / #4134) - @uppy/locales: Update pl_PL.js (Daniel Kamiński / #4136) - @uppy/core: Fix Uppy.cancelAll and Uppy.close types (Sven Grunewaldt / #4128) - @uppy/companion: fix error message (Mikael Finstad / #4125) - @uppy/xhr-upload: queue requests for socket token for remote files (Daniel Jones / #4123) Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
| Package | Version | Package | Version | | ---------------------- | ------- | ---------------------- | ------- | | @uppy/angular | 0.4.3 | @uppy/tus | 3.0.3 | | @uppy/aws-s3 | 3.0.3 | @uppy/url | 3.1.0 | | @uppy/companion | 4.0.4 | @uppy/webcam | 3.2.1 | | @uppy/core | 3.0.3 | @uppy/xhr-upload | 3.0.3 | | @uppy/golden-retriever | 3.0.2 | uppy | 3.2.0 | | @uppy/locales | 3.0.2 | | | - @uppy/webcam: fix bug when Dashboard is using a custom id (Antoine du Hamel / #4099) - @uppy/url: refactor `UrlUI` (Antoine du Hamel / #4143) - @uppy/url: trim whitespace around user input (Andrew McIntee / #4143) - @uppy/core: do not crash if a file is removed before the upload starts (Antoine du Hamel / #4148) - @uppy/xhr-upload: fix `Timed out waiting for socket` (Antoine du Hamel / #4150) - @uppy/golden-retriever: Fix retry upload with Golden Retriever (Merlijn Vos / #4155) - @uppy/aws-s3,@uppy/xhr-upload: fix `Cannot mark a queued request as done` in `MiniXHRUpload` (Antoine du Hamel / #4151) - meta: add a CI check to validate `yarn.lock` (Antoine du Hamel / #4154) - meta: fix outdated `yarn.lock` (Antoine du Hamel / #4153) - meta: fix `transloadit-xhr` dev example (Antoine du Hamel / #4149) - meta: Add example for Uppy with S3 and a Node.js server (Raúl Ibáñez / #4129) - @uppy/locales: Fix duplicate keys in UK_UA.js (Murderlon) - @uppy/companion: add workaround for S3 accelerated endpoints (Mikael Finstad / #4140) - @uppy/locales: Add missing Ukrainian locale entries (Andrii Bodnar / #4145) - @uppy/angular: remove unnecessary `console.log` call (Antoine du Hamel / #4139) - meta: fix bundlers workflow (Antoine du Hamel / #4144) - meta: fix default sources (Mikael Finstad / #4134) - @uppy/locales: Update pl_PL.js (Daniel Kamiński / #4136) - @uppy/core: Fix Uppy.cancelAll and Uppy.close types (Sven Grunewaldt / #4128) - @uppy/companion: fix error message (Mikael Finstad / #4125) - @uppy/xhr-upload: queue requests for socket token for remote files (Daniel Jones / #4123) Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
hasBeenRemoved
flag to UppyFile
| Package | Version | Package | Version | | ---------------------- | ------- | ---------------------- | ------- | | @uppy/angular | 0.4.3 | @uppy/tus | 3.0.3 | | @uppy/aws-s3 | 3.0.3 | @uppy/url | 3.1.0 | | @uppy/companion | 4.0.4 | @uppy/webcam | 3.2.1 | | @uppy/core | 3.0.3 | @uppy/xhr-upload | 3.0.3 | | @uppy/golden-retriever | 3.0.2 | uppy | 3.2.0 | | @uppy/locales | 3.0.2 | | | - @uppy/webcam: fix bug when Dashboard is using a custom id (Antoine du Hamel / transloadit#4099) - @uppy/url: refactor `UrlUI` (Antoine du Hamel / transloadit#4143) - @uppy/url: trim whitespace around user input (Andrew McIntee / transloadit#4143) - @uppy/core: do not crash if a file is removed before the upload starts (Antoine du Hamel / transloadit#4148) - @uppy/xhr-upload: fix `Timed out waiting for socket` (Antoine du Hamel / transloadit#4150) - @uppy/golden-retriever: Fix retry upload with Golden Retriever (Merlijn Vos / transloadit#4155) - @uppy/aws-s3,@uppy/xhr-upload: fix `Cannot mark a queued request as done` in `MiniXHRUpload` (Antoine du Hamel / transloadit#4151) - meta: add a CI check to validate `yarn.lock` (Antoine du Hamel / transloadit#4154) - meta: fix outdated `yarn.lock` (Antoine du Hamel / transloadit#4153) - meta: fix `transloadit-xhr` dev example (Antoine du Hamel / transloadit#4149) - meta: Add example for Uppy with S3 and a Node.js server (Raúl Ibáñez / transloadit#4129) - @uppy/locales: Fix duplicate keys in UK_UA.js (Murderlon) - @uppy/companion: add workaround for S3 accelerated endpoints (Mikael Finstad / transloadit#4140) - @uppy/locales: Add missing Ukrainian locale entries (Andrii Bodnar / transloadit#4145) - @uppy/angular: remove unnecessary `console.log` call (Antoine du Hamel / transloadit#4139) - meta: fix bundlers workflow (Antoine du Hamel / transloadit#4144) - meta: fix default sources (Mikael Finstad / transloadit#4134) - @uppy/locales: Update pl_PL.js (Daniel Kamiński / transloadit#4136) - @uppy/core: Fix Uppy.cancelAll and Uppy.close types (Sven Grunewaldt / transloadit#4128) - @uppy/companion: fix error message (Mikael Finstad / transloadit#4125) - @uppy/xhr-upload: queue requests for socket token for remote files (Daniel Jones / transloadit#4123) Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
No description provided.