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

@uppy/dashboard: fix handling of null for doneButtonHandler #5283

Merged
merged 1 commit into from
Jun 27, 2024

Conversation

aduh95
Copy link
Contributor

@aduh95 aduh95 commented Jun 27, 2024

As documented, null should not be treated the same as undefined.

Fixes: #5282

As documented, `null` should not be treated the same as `undefined`.
Copy link
Contributor

Diff output files
diff --git a/packages/@uppy/dashboard/lib/Dashboard.js b/packages/@uppy/dashboard/lib/Dashboard.js
index 05cad99..31f37a0 100644
--- a/packages/@uppy/dashboard/lib/Dashboard.js
    b/packages/@uppy/dashboard/lib/Dashboard.js
@@ -74,7  74,7 @@ const defaultOptions = {
   autoOpenFileEditor: false,
   disabled: false,
   disableLocalFiles: false,
-  doneButtonHandler: null,
   doneButtonHandler: undefined,
   onRequestCloseModal: null,
 };
 var _disabledNodes = _classPrivateFieldLooseKey("disabledNodes");
@@ -90,7  90,7 @@ var _autoDiscoverPlugins = _classPrivateFieldLooseKey("autoDiscoverPlugins");
 var _addSupportedPluginIfNoTarget = _classPrivateFieldLooseKey("addSupportedPluginIfNoTarget");
 export default class Dashboard extends UIPlugin {
   constructor(uppy, _opts) {
-    var _this$opts4, _this$opts4$doneButto, _this$opts5, _this$opts5$onRequest;
     var _this$opts4, _this$opts4$onRequest;
     let autoOpen;
     if (!_opts) {
       autoOpen = null;
@@ -1071,15  1071,15 @@ export default class Dashboard extends UIPlugin {
     this.title = "Dashboard";
     this.type = "orchestrator";
     this.defaultLocale = locale;
-    (_this$opts4$doneButto = (_this$opts4 = this.opts).doneButtonHandler) != null
-      ? _this$opts4$doneButto
-      : _this$opts4.doneButtonHandler = () => {
     if (this.opts.doneButtonHandler === undefined) {
       this.opts.doneButtonHandler = () => {
         this.uppy.clearUploadedFiles();
         this.requestCloseModal();
       };
-    (_this$opts5$onRequest = (_this$opts5 = this.opts).onRequestCloseModal) != null
-      ? _this$opts5$onRequest
-      : _this$opts5.onRequestCloseModal = () => this.closeModal();
     }
     (_this$opts4$onRequest = (_this$opts4 = this.opts).onRequestCloseModal) != null
       ? _this$opts4$onRequest
       : _this$opts4.onRequestCloseModal = () => this.closeModal();
     this.i18nInit();
   }
 }

@aduh95 aduh95 merged commit 7cf5c5d into main Jun 27, 2024
17 checks passed
@aduh95 aduh95 deleted the doneButtonHandler-null branch June 27, 2024 15:18
github-actions bot added a commit that referenced this pull request Jun 27, 2024
| Package          | Version | Package          | Version |
| ---------------- | ------- | ---------------- | ------- |
| @uppy/dashboard  |   3.9.1 | uppy             |  3.27.1 |
| @uppy/xhr-upload |   3.6.8 |                  |         |

- @uppy/xhr-upload: add `'PATCH'` as valid method (Quinn Daley / #5279)
- @uppy/dashboard: fix handling of `null` for `doneButtonHandler` (Antoine du Hamel / #5283)
- meta: Bump docker/build-push-action from 5.4.0 to 6.1.0 (dependabot[bot] / #5272)
- docs: rewrite Instagram dev setup section (Evgenia Karunus / #5274)
- meta: remove the Zoom section from `CONTRIBUTING.md` (Evgenia Karunus / #5273)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Done button shows when doneButtonHandler is null
1 participant