Skip to content

Inflated loaded value in onUploadProgress — react native #7232

@omrikir

Description

@omrikir

Describe the bug

onUploadProgress returns a value bigger than 100% in the progress in both development mode and production build.

 LOG  progress: {"bytes": 1, "estimated": undefined, "event": {"isTrusted": false, "lengthComputable": true, "loaded": 1, "total": 400155}, "lengthComputable": true, "loaded": 1, "progress": 0.0000024990316252452173, "rate": undefined, "total": 400155, "upload": true}
 LOG  progress: {"bytes": 712703, "estimated": undefined, "event": {"isTrusted": false, "lengthComputable": true, "loaded": 712704, "total": 400155}, "lengthComputable": true, "loaded": 712704, "progress": 1.7810698354387675, "rate": 3, "total": 400155, "upload": true}

We've recently upgraded our react native version from ~0.73, where the onUploadProgress used to work correctly, returning us values from 0-100% but after the update to react native 0.81.4, it got broken...

I saw a comment on another issue (#6951 (comment)) stating that it should be working correctly on a production build, but we've tried that and unfortunately it didn't work...

To Reproduce

No response

Code snippet

useEffect(() => {
        const form = new FormData();

        form.append('test', '1234567890'.repeat(20000));

        axios.post('https://httpbin.org/post', form, {
            headers: {
                "Content-Type": "multipart/form-data",
            },
            onUploadProgress: (progressEvent) => {
                console.log("progress:", progressEvent);
                setProgress(progressEvent.progress ?? 0);
            },
        })
            .then(response => {
                setData(response.data);
                setLoading(false);
            })
            .catch(err => {
                setError(err.message);
                setLoading(false);
            });
    }, []);

Expected behavior

No response

Axios Version

1.13.2

Adapter Version

No response

Browser

No response

Browser Version

No response

Node.js Version

20.19.4

OS

No response

Additional Library Versions

React Native 0.81.4

Additional context/Screenshots

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue::bugThis issue is related to a bug that requires fixing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions