nextcloud-libraries / nextcloud-libraries/nextcloud-vue
[RFC] Improve `spawnDialog` or add a new function
Open
A pull request for this has already been merged.
- #6768 by @backportbot — merged
2. developing
feature: functions
- Dominant language
- Vue
- Stars
- 246
- Forks
- 99
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 103
Description
Problem
In the current implementation spawnDialog is designed to create a one-time "prompt" dialog:
- It doesn't provide control over the mounted dialog, for example, to
unmountit or call its public methods - Use case: https://github.com/nextcloud-libraries/nextcloud-dialogs/blob/main/lib/dialogs.ts#L80
But at the same time, it isn't convenient as a prompt, requiring to pass callback instead of returning a promise.
Proposals
- Instead of only calling callback - return promise
- How to determine if it was closed or unmounted?
- Provide 2 functions:
- One for one-time prompts returning a promise
- One for mounting a dialog instance
- Return promise with additional properties
Additional problem
In the current API props argument is passed as dialog component props, but it includes container and appContext, which are not dialog props.
We can mix it and only fix the implementation, or separate dialog's props and spawnDialog's options (breaking change).
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.