primevue icon indicating copy to clipboard operation
primevue copied to clipboard

The priority of default-value is higher than v-model.

Open vicuna-main opened this issue 7 months ago • 1 comments

Describe the bug

The original issue https://github.com/primefaces/primevue/issues/7589 shows as fixed, but a new problem has emerged. When using v-model, if default-value=null or 0 is set, it forcibly displays "null" or "0" instead of showing the value from v-model. This appears to be a regression in the fix.

Pull Request Link

No response

Reason for not contributing a PR

  • [ ] Lack of time
  • [ ] Unsure how to implement the fix/feature
  • [ ] Difficulty understanding the codebase
  • [ ] Other

Other Reason

No response

Reproducer

https://stackblitz.com/edit/primevue-baseinput-falsy-default-1o1epm7d?file=src%2FApp.vue

Environment

N/A

Vue version

N/A

PrimeVue version

4.3.4

Node version

N/A

Browser(s)

N/A

Steps to reproduce the behavior

Use a component with both v-model and default-value=null

The component displays "null" text instead of the v-model value

Expected behavior

The component should respect the v-model value when default-value is null

vicuna-main avatar May 24 '25 16:05 vicuna-main

I believe this is a non issue as v-model and default-value are not meant to be used at the same time. default-value is for "uncontrolled mode"; from the docs:

The default value for the input when not controlled by modelValue.

I.e. if you are using modelValue (v-model) you should not also have a default-value.

@tugcekucukoglu correct me if I'm wrong, but this was my understanding.

ajm13 avatar May 24 '25 17:05 ajm13