Comments (4)
export const Uploader = React.memo((props: IProps) => {
const {
owner,
concurrent = false,
maxConcurrent = 5,
multiple = false,
grouped = false,
accept,
onItemFinish,
onBatchFinish,
listeners,
maxUploadCount = Number.MAX_SAFE_INTEGER,
dropzoneProps,
enhancer,
params = {},
...rest
} = props
const previewMethodsRef = useRef<any>();
const defaultListeners = useMemo(() => ({
[UPLOADER_EVENTS.BATCH_FINISH]: (batch) => {
const { id, items } = batch;
if (typeof onBatchFinish === "function") {
const data = parseResponse(items[0].uploadResponse);
console.log(`BATCH Finish - ${id} ${JSON.stringify(data)}`);
onBatchFinish(data);
}
//
// if (previewMethodsRef.current?.clear) {
// previewMethodsRef!.current.clear();
// }
},
[UPLOADER_EVENTS.ITEM_FINISH]: (item) => {
if (typeof onItemFinish === "function") {
const data = parseResponse(item.uploadResponse);
console.log(`Item Finish - ${item.id} : ${item.file.name} ${JSON.stringify(data)}`);
onItemFinish(data);
}
},
}), []);
const [previews, setPreviews] = useState();
const getPreviewProps = useCallback((item, url, type) => ({ id: item.id, url, type }), []);
const enhancerComposed = enhancer ? composeEnhancers(retryEnhancer, enhancer) : retryEnhancer;
console.log(previews);
return (
<UploadyProvider
// debug
accept={accept}
concurrent={concurrent}
maxConcurrent={maxConcurrent}
multiple={multiple}
listeners={listeners ?? defaultListeners}
grouped={grouped}
forceJsonResponse
enhancer={enhancerComposed}
{...rest}
>
<UploadPreviews
rememberPreviousBatches
previewMethodsRef={previewMethodsRef}
previewComponentProps={getPreviewProps}
PreviewComponent={PreviewImage}
onPreviewsChanged={setPreviews}
/>
{
(previews && previews.length < (multiple ? maxUploadCount : 1))
? <Dropzone {...dropzoneProps} accept={accept} multiple={multiple}/>
: null as any
}
</UploadyProvider>
)
})
from react-uploady.
@omcg33 please check with 0.6.0. fix for this was just released
from react-uploady.
Retry works, but i got something strange.
I abort and retry items in batch of 7 items, and got this error
batchHelpers.js:13 Uncaught (in promise) TypeError: Cannot read property 'batch' of undefined
at getBatchFromState (batchHelpers.js:13)
at triggerUploaderBatchEvent (batchHelpers.js:106)
at cleanUpFinishedBatch (batchHelpers.js:98)
at processFinishedRequest.js:65
at processBatchItems.js:94
And all my not uploaded items is disappeared!
Steps to reproduce:
- Slow network speed
- Upload 10 items in 1 batch on multiply
- Abort and retry all of items step by step
- Wait then about 20% of items will be uploaded
- Items disappeared and you got error
from react-uploady.
Thanks. will look into it.
in the meantime, can you plz open a new bug?
from react-uploady.
Related Issues (20)
- Retry doesnt "remember" SendOptions HOT 4
- Allow clearing a single preview using the UploadPreview methods HOT 1
- event UPLOADER_EVENTS.ITEM_FINISH gets fired only once when uploading multiple files HOT 3
- Canceled batch is processed the next time I choose a file HOT 5
- error in production: Cannot assign to read only property 'state' of object '#' HOT 3
- Not working with edge runtime HOT 5
- nextjs 13.4 issue with react-uploady - Expected server HTML to contain a matching <input> in <div> HOT 3
- Clicking to crop image using react-image-crop makes the image disappear HOT 1
- BATCH_FINALIZE and BATCH_FINISH listeners not calling HOT 7
- use*ProgressListener reports uneven completed percentage when files are different sizes HOT 2
- Support for userData in upload options HOT 4
- Make uploadResponse and uploadStatus accessible inside useItemErrorListener with ChunkedUploady HOT 4
- Upload function is not working for createUploader object from @rpldy/uploader package HOT 3
- Batch progress completion incorrect when using mock sender HOT 9
- cancellable hooks types dont allow asynchronousity HOT 1
- export `getPreviewsLoaderHook` for public use HOT 4
- UploadDropZone: Child Element Handling in onDragLeave has issues HOT 3
- Initial Post Request doesnt set header "Upload-Concat": "partial" when parallel is >1 HOT 3
- file field is required error HOT 4
- TusUploady + supabase storage gives ChunkedSendError: start byte 84715 is invalid. File size: 84715 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-uploady.