-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
fix(components): [upload] before-upload change data in promise #12575
Conversation
👋 @GenerQAQ, seems like this is your first time contribution to element-plus.
|
Hi, thank you for your contribution. However, the relevant pr seems to already exist. #12344 |
Yes~I saw that his submission was quite complex, and I feel that my one is quite elegant, hahaha |
@chenxch what do you think? |
@chenxch pls~ |
🧪 Playground Preview: https://element-plus.run/?pr=12575 |
@GenerQAQ Good job, would you mind adding a test case, the case is as follows:
|
No problem, later today~ |
Added case |
…ent-plus into fix/upload-promise
Modified a case error |
…ent-plus into fix/upload-promise
Corrected lint error, thx~ |
2590103
to
af228ef
Compare
@chenxch I submitted an incorrect PR and it has now been restored. Sorry! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
…ent-plus into fix/upload-promise
@chenxch @btea @ryuhangyeong May I ask what further steps are required to merge this PR? |
I think there seems to be no problem. |
|
@lyhczz Same question, but i havd made a solution to make this code work well. Modify the file of In function const upload = async (rawFile) => {
...
try {
const originData = props.data;
const beforeUploadPromise = props.beforeUpload(rawFile);
hookResult = await beforeUploadPromise; // Change the order of calling this statement before to update `beforeData`
beforeData = isObject(props.data) ? cloneDeep(props.data) : props.data;
if (isObject(props.data) && isEqual(originData, beforeData)) {
beforeData = cloneDeep(props.data);
}
} catch (e) {
hookResult = false;
}
...
}; After that, manually import this component form import { ElUpload } from "element-plus/es/components/upload/index" But i wonder if i should make a PR to slove this prolem. |
/cc @GenerQAQ Would you please take a look at this question? Thank you very much. |
This issue seems to have not been resolved yet. My version is 2.3.8, El-Upload reactivity of 'data' attribute has been broken in 2.3.2 onwards |
…nt-plus#12575) * fix(components): [upload] befroe-upload change data in promise closed element-plus#12340 * fix(components): [upload] befroe-upload change data in promise closed element-plus#12340
closed #12340
Please make sure these boxes are checked before submitting your PR, thank you!
dev
branch.