Skip to content

feat(dialogs/spawnDialog): return promise with the result #6758

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

Merged
merged 1 commit into from
Apr 10, 2025

Conversation

ShGKme
Copy link
Contributor

@ShGKme ShGKme commented Apr 8, 2025

☑️ Resolves

🏁 Checklist

  • ⛑️ Tests are included or are not applicable
  • 📘 Component documentation has been extended, updated or is not applicable
  • 2️⃣ Backport to stable8 for maintained Vue 2 version or not applicable

@ShGKme ShGKme added enhancement New feature or request 3. to review Waiting for reviews feature: functions composables, functions, mixins and other non-components labels Apr 8, 2025
@ShGKme ShGKme added this to the v9.0.0-rc.0 milestone Apr 8, 2025
@ShGKme ShGKme requested a review from susnux April 8, 2025 15:06
@ShGKme ShGKme self-assigned this Apr 8, 2025
element.remove()
const result = rest.map(v => toRaw(v))
onClose?.(...result)
resolve(result.length > 1 ? result : result[0])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you have to emit array or object your self?

Copy link
Contributor Author

@ShGKme ShGKme Apr 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, it's a common practice in Vue to always emit with one parameter in the payload. Then it's HTML-like and supports $event in template

Copy link
Contributor Author

@ShGKme ShGKme Apr 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But here, if you emit many values - you get an array.

And if you emitted 1 value - you get it directly

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but you only resolve the first argument

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I only resolve the first argument when there are no arguments after the first

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see 🙈

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@susnux It's me again.
What do you think about requiring to emit only one parameter? 👀

To keep description and typing simple.

@ShGKme ShGKme force-pushed the feat/spawnDialogs--promise branch from 9e491b1 to f6aa944 Compare April 10, 2025 14:32
@ShGKme ShGKme marked this pull request as ready for review April 10, 2025 14:33
@ShGKme ShGKme requested review from st3iny and Antreesy April 10, 2025 14:33
@susnux susnux merged commit 5244eee into main Apr 10, 2025
30 checks passed
@susnux susnux deleted the feat/spawnDialogs--promise branch April 10, 2025 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement New feature or request feature: functions composables, functions, mixins and other non-components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants