Releases: kqito/use-tus
v0.8.2
Changes in v0.8.2
Bug Fix: shouldTerminate Argument in abort Function
In this release, we've addressed an issue where the shouldTerminate argument was not being passed to the abort function in the use-tus library. This fix ensures that uploads can now be correctly terminated and the resource can be deleted on the server as intended. This change resolves issue #51.
v0.8.1
Changes in v0.8.1
tus-js-client Update
In this release, we've updated the tus-js-client version of peerDependencies to >=2.2.0
and resolving issue #38. Importantly, no APIs or interfaces have been modified with this update, ensuring a smooth transition for our users.
If you have any issues or suggestions, please let us know. We're always looking forward to your feedback!
v0.8.0
Overview
In this minor patch release of use-tus, I have made several improvements and changes to enhance the usability and flexibility of the library. The key changes include updates to re-rendering logic, modifications to callback handling, and the addition of new state and property arguments for hooks.
Details
Re-rendering when the url field is changed
In this release, I have updated the re-rendering logic to respond to changes in the url field of the upload instance. Previously, I avoided re-rendering due to concerns of excessive rendering. However, I now allow re-rendering when the url field is changed to accommodate cases where the url needs to be referred according to the react lifecycle.
Example:
useEffect(() => {
console.log("useEffect", upload?.url);
}, [upload?.url]);
Referencing upload within callback
Previously, it was not possible to refer to upload within callbacks such as onSuccess in useTus hooks and useTusStore hooks unless useRef was used. In this release, I have made modifications to allow receiving the upload instance as the last argument of various callbacks.
Example:
setUpload(file, {
onSuccess: (upload) => {
console.log(upload.url)
},
onError: (error, upload) => {
console.log(error)
setTimeout(() => {
upload.start()
}, 1000)
}
})
Additional Changes
- I have removed some types exported from 'tus-js-client' as 'tus-js-client' has been already defined as peerDependencies.
- A new
isUploading
state has been added which will be true when uploading with tus, and false otherwise. - I now support passing Upload property arguments for useTus and useTusStore hooks. This is useful for using a customized own Upload class with useTus.
- Some hooks types have been renamed for better clarity.
UseTusUseTusResult
has been renamed toTusHooksResult
andUseTusOptions
toTusHooksOptions
.
v0.7.3
v0.7.2
v0.7.1
v0.7.0
Update
Add support for react version to v18
Changed peerDependencies for use-tus to >=16.8
. This will fix issues like #35.
Also, there is no interface changes.
Bug fixs
Change isAbort
will be false after remove
function is called.
Change the behavior when the remove function of useTus
hooks is called.
Until now, calling the remove
function initialized the state and then set isAbort
to true.
Therefore, the state after calling the remove
function was different from the initial value.
So, we will change it so that isAbort
remains false after calling the remove
function.
Change setUpload
function will reset state.
Changed so that isAborted, isSuccess, etc. are initialized when the setUpload function of the useTus hooks is called.
Misc
- Use
FC
type instead ofVFC
to stories components - Remove
@testing-library/react-hooks
from dependencies
v0.6.1
v0.6.0
Overview
By #31
- Remove the
useTus
function to save to store usingcacheKey
- Add
useTusStore
hooks that has to save to store functionality. - Remove invalid props
canStoreUrls
fromTusClientProvider
Migrating from 0.5 to 0.6
If you use cacheKey options in useTus
hooks
The useTus
hooks have been removed the state management functionality using TusClientProvider
and cacheKey
option.
Therefore, if you are currently using useTus
hooks with cacheKey
option, you will need to change to use the newly added useTusStore
hooks.
import { useTusStore } from 'use-tus'
// Old usage
const { upload } = useTus({ cacheKey: 'hogehoge', autoAbort: true })
// New usage
const { upload } = useTusStore('hogehoge', { autoAbort: true })
The return value of each hooks is the same, so there is no need to make any other changes
If you not use cacheKey options in useTus
hooks
If you are using use-tus and not using the cacheKey
option, you no longer need to specify TusClientProvider
.
So please consider removing TusClientProvider
from the parent comport if necessary.
v0.5.0
Overview
- Move tus-js-client from dependencies to peerDependencies
- Fix to use
createElement
instead of JSX for support even react 16.x - Update README.md about installation
Upgrading from 0.4 to 0.5
Install tus-js-client
- we have to install
tus-js-client
for using use-tus as first.
npm install tus-js-client
or
yarn add tus-js-client
- Also, there is no need to rewrite the code.