Packages

@clerk/shared

4.45.1 · 14 Nov 2026MIT11.8M / weekRepositorynpmAtom feed

Your version

3.1.0

21 Mar 2025Where it was published

3.48.1 is the newest release of 3.x.

In short

1 new1 internal

Security

2 advisories affect 3.1.0; 3.47.5 fixes them

Release note

Minor Changes

  • This introducing changes to useReverification, the changes include removing the array and returning the fetcher directly and also the dropping the options throwOnCancel and onCancel in favour of always throwing the cancellation error.

    import { useReverification } from '@clerk/clerk-react';
    import { isReverificationCancelledError } from '@clerk/clerk-react/error';
    
    type MyData = {
      balance: number;
    };
    
    export function MyButton() {
      const fetchMyData = () => fetch('/api/balance').then(res => res.json() as Promise<MyData>);
      const enhancedFetcher = useReverification(fetchMyData);
    
      const handleClick = async () => {
        try {
          const myData = await enhancedFetcher();
          //     ^ is typed as `MyData`
        } catch (e) {
          // Handle error returned from the fetcher here
          // You can also handle cancellation with the following
          if (isReverificationCancelledError(err)) {
            // Handle the cancellation error here
          }
        }
      };
    
      return <button onClick={handleClick}>Update User</button>;
    }

    These changes are also adding a new handler in options called onNeedsReverification, which can be used to create a custom UI
    to handle re-verification flow. When the handler is passed the default UI our AIO components provide will not be triggered so you will have to create and handle the re-verification process.

    import { useReverification } from '@clerk/clerk-react';
    import { isReverificationCancelledError } from '@clerk/clerk-react/error';
    
    type MyData = {
      balance: number;
    };
    
    export function MyButton() {
      const fetchMyData = () => fetch('/api/balance').then(res => res.json() as Promise<MyData>);
      const enhancedFetcher = useReverification(fetchMyData, {
        onNeedsReverification: ({ complete, cancel, level }) => {
          // e.g open a modal here and handle the re-verification flow
        },
      });
    
      const handleClick = async () => {
        try {
          const myData = await enhancedFetcher();
          //     ^ is typed as `MyData`
        } catch (e) {
          // Handle error returned from the fetcher here
    
          // You can also handle cancellation with the following
          if (isReverificationCancelledError(err)) {
            // Handle the cancellation error here
          }
        }
      };
    
      return <button onClick={handleClick}>Update User</button>;
    }

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.