Suspense boundary in Dialog Plugin custom component #16621
-
|
Currently, it seems impossible to use components with an async setup() hook together with Dialog Plugin, as it throws the following error: I have tried the suggested solution in #13463 with |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
|
Repro: https://stackblitz.com/edit/quasarframework-ye5hgh?file=src%2Fpages%2FIndexPage.vue |
Beta Was this translation helpful? Give feedback.
-
|
thank you for your input! The problem is - your suggestion to use: $q.dialog({
component: await defineAsyncComponent(() => import('./MyAsyncSetupDialog.vue')).__asyncLoader(),
})doesn't work. I'm still getting: and $q.dialog({
component: defineAsyncComponent(() => import('./MyAsyncSetupDialog.vue')),
})also doesn't work. How can we use the dialog plugin with a component that has an async setup function? Thank you in advance. |
Beta Was this translation helpful? Give feedback.
-
|
Ok, I got it - the component in the dialog is async. Let me research. |
Beta Was this translation helpful? Give feedback.
You need to make a wrapper dialog component that is not async and pass it the async component.
In the example the wrapper will:
componentkey incomponentPropsloaderincomponentPropsfor the#fallbackslot in SuspensecomponentProps(exceptcomponentandloader) andonDialogHide,onDialogOK, andonDialogCancelto the final componenthttps://pdanpdan.github.io/quasar-play/?file=src%2FAsyncDialogWrapper.vue&preview=t&previewMode=preview&editor=codemirror#eNrFWYtuGzcW/RWuuljJgDWykl2gUO0k3tTbdvNwaqfYBarAoWYomfEMOSE5sl3X/77nkvOURu46aFEYsIfk5X3xPg7pu4HMcm3cOON59MlqNZgN7uaKsXm5YOeDGfMzNPe54JYbmpoPLp3L7WwyKVR+tYpinU3C6osn0fTv0XSSSOvK…