Skip to content

Releases: kqito/use-tus

v0.8.2

24 Aug 02:53
5dec07c
Compare
Choose a tag to compare

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

18 Dec 10:26
c1822ea
Compare
Choose a tag to compare

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

26 Nov 04:01
Compare
Choose a tag to compare

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 to TusHooksResult and UseTusOptions to TusHooksOptions.

v0.7.3

21 Oct 10:50
2e73c20
Compare
Choose a tag to compare

Overview

  • Fix failed publishing workflow: #41

v0.7.2

21 Oct 10:49
2e73c20
Compare
Choose a tag to compare

Overview

  • Change to use esbuild instead of babel: #40

v0.7.1

23 Nov 10:11
Compare
Choose a tag to compare

Overview

  • Fix typo in README.md #37

v0.7.0

05 Jun 13:22
Compare
Choose a tag to compare

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 of VFC to stories components
  • Remove @testing-library/react-hooks from dependencies

v0.6.1

23 May 04:36
Compare
Choose a tag to compare

Overview

Thank you !!

v0.6.0

26 Mar 11:44
Compare
Choose a tag to compare

Overview

By #31

  • Remove the useTus function to save to store using cacheKey
  • Add useTusStore hooks that has to save to store functionality.
  • Remove invalid props canStoreUrls from TusClientProvider

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

01 Dec 11:31
Compare
Choose a tag to compare

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.