removeFile in QFile actually expects a test function instead of a File #15727
Labels
area/components
bug/1-repro-available
A reproduction is available and needs to be confirmed.
flavour/quasar-cli-webpack
kind/bug 🐞
Qv1
Qv2 🔝
Quasar v2 issues
What happened?
Using
qFileRef.removeFile(file)
won't work, as it actually expects a functionWhat did you expect to happen?
It should work as per docs API
Reproduction URL
https://stackblitz.com/edit/quasarframework-webpack-1u1zmr?file=src/pages/IndexPage.vue
How to reproduce?
Flavour
Quasar CLI with Webpack (@quasar/cli | @quasar/app-webpack)
Areas
Components (quasar)
Platforms/Browsers
No response
Quasar info output
No response
Relevant log output
Additional context
Looking at the commit history, it appears the problem is there since the QFile inception
Since we internally use
removeAtIndex
and there are no examples using this method on the docs, this never got caughtremoveFile
expects a File as param per docs, but then uses it as a function provided tofindIndex
quasar/ui/src/components/file/QFile.js
Line 123 in 2064fad
I'd propose to fix it in this way
The
file instanceof Function
is meant to avoid a breaking change for who's using the current incorrect signature, which should probably be deprecated and removed in the next major versionThe same problem affects Qv1 and the fix can be backported
The same function on QUploader works correctly, accepting a File as documented in the docs
The text was updated successfully, but these errors were encountered: