Skip to content
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

[Bug Report] Unable to select same file twice when value cleared #9045

Closed
matthieusieben opened this issue Sep 20, 2019 · 4 comments · Fixed by #9091 or drakeg/vue_learn#9
Closed

[Bug Report] Unable to select same file twice when value cleared #9045

matthieusieben opened this issue Sep 20, 2019 · 4 comments · Fixed by #9091 or drakeg/vue_learn#9
Labels
C: VFileInput T: bug Functionality that does not work as intended/expected

Comments

@matthieusieben
Copy link
Contributor

matthieusieben commented Sep 20, 2019

Environment

Vuetify Version: 2.0.18
Vue Version: 2.6.10
Browsers: Chrome 76.0.3809.132
OS: Mac OS 10.14.6

Steps to reproduce

Pick a file using a v-file-input, clear the v-model programmatically (using the button in the codepen), try to pick the exact same file again, the input value will not be set.

Expected Behavior

The inner "file" input's value should be cleared when the value prop is changed

Actual Behavior

The inner "file" input element's value is not cleared when the value prop changes

Reproduction Link

https://codepen.io/matthieusieben/pen/NWKEEQo

Other comments

I was able to "hack" around the issue using the following watch function (in the vuetify's VFileInput.ts source code):

    value(val) {
      if (!val) this.$refs.input.value = ''
    },
@ghost ghost added the S: triage label Sep 20, 2019
@dsseng dsseng added C: VFileInput T: bug Functionality that does not work as intended/expected and removed S: triage labels Sep 21, 2019
@dsseng
Copy link
Contributor

dsseng commented Sep 21, 2019

you can open a PR with your fix

johnleider added a commit that referenced this issue Oct 24, 2019
* fix(VFileInput): trigger onInput after value has changed

fixes: #9045

* Update VFileInput.ts

* Styling

* Update packages/vuetify/src/components/VFileInput/VFileInput.ts

Co-Authored-By: John Leider <john@vuetifyjs.com>
@ardabzlk
Copy link

I've solved this problem by adding :key property to tag, and initialized key value with 0, whenever I want to reset file input I increase :key="inputKey" with 1
My data =>
data() { return { inputKey: 0 } }
My reset function =>
closeNewPhotoDialog() { this.inputKey++; }
My component =>
<v-file-input v-model="newPhotoTextField" :key="inputKey">

@johnleider
Copy link
Member

We kindly ask users to not comment on closed/resolved issues. If you believe that this issue has not been correctly resolved, please create a new issue showing the regression or create a new discussion.

If you have any questions, please reach out to us in our Discord community.

@vuetifyjs vuetifyjs locked as resolved and limited conversation to collaborators Aug 12, 2021
@johnleider
Copy link
Member

We kindly ask users to not comment on closed/resolved issues. If you believe that this issue has not been correctly resolved, please create a new issue showing the regression or create a new discussion.

If you have any questions, please reach out to us in our Discord community.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C: VFileInput T: bug Functionality that does not work as intended/expected
Projects
None yet
4 participants