From 88ead93cfdda00dc7ecf6b550258eda80fb530af Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Tue, 29 Apr 2025 12:23:36 +0200 Subject: [PATCH] chore: deprecate `Dialog.hide` Signed-off-by: Ferdinand Thiessen --- CHANGELOG.md | 4 ++++ lib/dialogs.ts | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aafe3d8e0..1260e5b14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ All notable changes to this project will be documented in this file. The export of the file picker Vue component is deprecated and will be removed in the next version. Instead please use the `FilePickerBuilder`. +The `Dialog.hide` method is deprecated. +Instead only user interaction should close dialogs, +for this use the promise returned by `Dialog.show` which will resolve if the user answered the dialog and rejected if the user aborted (closed) the dialog. + ## 6.1.1 [Full Changelog](https://github.com/nextcloud-libraries/nextcloud-dialogs/compare/v6.1.0...v6.1.1) diff --git a/lib/dialogs.ts b/lib/dialogs.ts index ea3344a7e..497b19f48 100644 --- a/lib/dialogs.ts +++ b/lib/dialogs.ts @@ -54,7 +54,7 @@ export class Dialog { * Spawn and show the dialog - if already open the previous instance will be destroyed * @return Promise that resolves when the dialog is answered successfully and rejects on close */ - show() { + async show() { if (this.#dialog) { this.#dialog.$destroy() } @@ -75,6 +75,8 @@ export class Dialog { /** * Hide and destroy the current dialog instance + * + * @deprecated use the promise of the `show` methods for the user interaction. */ hide() { this.#dialog?.$destroy()