unovue / shadcn-vue

Vue port of shadcn-ui
https://www.shadcn-vue.com/
MIT License
4.84k stars 278 forks source link

[Bug]: Form default values not displayed in dialog component #459

Closed A-kirami closed 6 months ago

A-kirami commented 6 months ago

Reproduction

https://stackblitz.com/edit/vitejs-vite-kztmwi?file=src%2FApp.vue

Describe the bug

Description

Default values are not displaying in forms within the dialog component after the first opening.

Steps to reproduce

  1. Click to open the dialog. image
  2. Close the dialog.
  3. Open the dialog again. image

Expected behavior

The default values within the form should remain visible upon subsequent openings of the dialog.

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.3 - /usr/local/bin/pnpm
  npmPackages:
    @vueuse/core: ^10.9.0 => 10.9.0 
    radix-vue: ^1.6.1 => 1.6.1 
    vue: ^3.4.21 => 3.4.21

Contributes

sadeghbarati commented 6 months ago

@A-kirami Hi

in Dialogs it's better to use the vee-validate Form component

https://stackblitz.com/edit/vitejs-vite-4h9oqf

If you want to use useForm composable instead, you need to create a custom hard-coded form component based on your form fields

A-kirami commented 6 months ago

@A-kirami Hi

in Dialogs it's better to use the vee-validate Form component

stackblitz.com/edit/vitejs-vite-4h9oqf

Thank you for the prompt response and solution!

I would like to suggest adding documentation about this issue and its resolution to the project's documentation. It would be helpful for users who might encounter similar issues in the future.

A-kirami commented 6 months ago

@A-kirami Hi

in Dialogs it's better to use the vee-validate Form component

stackblitz.com/edit/vitejs-vite-4h9oqf

If you want to use useForm composable instead, you need to create a custom hard-coded form component based on your form fields

Sorry, I'm not quite sure what a custom hard-coded form component is. Could you provide documentation or a demo? Thanks!

sadeghbarati commented 6 months ago

@A-kirami Sure will update stackblitz

sadeghbarati commented 6 months ago

@A-kirami https://stackblitz.com/edit/vitejs-vite-b87ysk

A-kirami commented 6 months ago

@A-kirami stackblitz.com/edit/vitejs-vite-b87ysk

Thank you for providing the demo! This resolves the issue for me.