Skip to content

Commit

Permalink
Merge branch 'master' into jingsong.xiong/fix-files-ts-error
Browse files Browse the repository at this point in the history
  • Loading branch information
aslan-alt committed Apr 28, 2022
2 parents d164104 + 2a71cc9 commit 7e5235d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
8 changes: 5 additions & 3 deletions examples/previews/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,17 @@ function Previews(props) {
<img
src={file.preview}
style={img}
// Revoke data uri after image is loaded
onLoad={() => { URL.revokeObjectURL(file.preview) }}
/>
</div>
</div>
));

useEffect(() => {
// Make sure to revoke the data uris to avoid memory leaks
files.forEach(file => URL.revokeObjectURL(file.preview));
}, [files]);
// Make sure to revoke the data uris to avoid memory leaks, will run on unmount
return () => files.forEach(file => URL.revokeObjectURL(file.preview));
}, []);

return (
<section className="container">
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
},
"dependencies": {
"attr-accept": "^2.2.2",
"file-selector": "^0.4.0",
"file-selector": "^0.5.0",
"prop-types": "^15.8.1"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/__snapshots__/index.spec.js.snap
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`useDropzone() hook behavior renders the root and input nodes with the necessary props 1`] = `"<div role=\\"button\\" tabindex=\\"0\\"><input multiple=\\"\\" type=\\"file\\" style=\\"display: none;\\" autocomplete=\\"off\\" tabindex=\\"-1\\"></div>"`;
exports[`useDropzone() hook behavior renders the root and input nodes with the necessary props 1`] = `"<div role=\\"button\\" tabindex=\\"0\\"><input multiple=\\"\\" type=\\"file\\" style=\\"display: none;\\" tabindex=\\"-1\\"></div>"`;
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,6 @@ export function useDropzone(options = {}) {
onClick: composeHandler(
composeEventHandlers(onClick, onInputElementClick)
),
autoComplete: "off",
tabIndex: -1,
[refKey]: inputRef,
};
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6189,10 +6189,10 @@ file-loader@^6.0.0:
loader-utils "^2.0.0"
schema-utils "^3.0.0"

file-selector@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/file-selector/-/file-selector-0.4.0.tgz#59ec4f27aa5baf0841e9c6385c8386bef4d18b17"
integrity sha512-iACCiXeMYOvZqlF1kTiYINzgepRBymz1wwjiuup9u9nayhb6g4fSwiyJ/6adli+EPwrWtpgQAh2PoS7HukEGEg==
file-selector@^0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/file-selector/-/file-selector-0.5.0.tgz#21c7126dc9728b31a2742d91cab20d55e67e4fb4"
integrity sha512-s8KNnmIDTBoD0p9uJ9uD0XY38SCeBOtj0UMXyQSLg1Ypfrfj8+dAvwsLjYQkQ2GjhVtp2HrnF5cJzMhBjfD8HA==
dependencies:
tslib "^2.0.3"

Expand Down

0 comments on commit 7e5235d

Please sign in to comment.