linXiv frontend (TS/JS)
    Preparing search index...

    Function useImportReceived

    • Import a received mirror into the library; shared by the card's visible "Import to library" button and the settings dialog's Local-project row. isPending is derived across ALL instances of the keyed mutation, so the dialog's button is disabled while the card's import is in flight (and vice versa) instead of firing a duplicate import.

      Parameters

      • shareId: string

      Returns
          | {
              context: unknown;
              data: undefined;
              error: null;
              failureCount: number;
              failureReason: Error
              | null;
              isError: false;
              isIdle: true;
              isPaused: boolean;
              isPending: boolean;
              isSuccess: false;
              mutate: UseMutateFunction<ImportedReceipt, Error, void, unknown>;
              mutateAsync: UseMutateAsyncFunction<ImportedReceipt, Error, void, unknown>;
              reset: () => void;
              status: "idle";
              submittedAt: number;
              variables: undefined;
          }
          | {
              context: unknown;
              data: undefined;
              error: null;
              failureCount: number;
              failureReason: Error
              | null;
              isError: false;
              isIdle: false;
              isPaused: boolean;
              isPending: boolean;
              isSuccess: false;
              mutate: UseMutateFunction<ImportedReceipt, Error, void, unknown>;
              mutateAsync: UseMutateAsyncFunction<ImportedReceipt, Error, void, unknown>;
              reset: () => void;
              status: "pending";
              submittedAt: number;
              variables: void;
          }
          | {
              context: unknown;
              data: undefined;
              error: Error;
              failureCount: number;
              failureReason: Error
              | null;
              isError: true;
              isIdle: false;
              isPaused: boolean;
              isPending: boolean;
              isSuccess: false;
              mutate: UseMutateFunction<ImportedReceipt, Error, void, unknown>;
              mutateAsync: UseMutateAsyncFunction<ImportedReceipt, Error, void, unknown>;
              reset: () => void;
              status: "error";
              submittedAt: number;
              variables: void;
          }
          | {
              context: unknown;
              data: ImportedReceipt;
              error: null;
              failureCount: number;
              failureReason: Error
              | null;
              isError: false;
              isIdle: false;
              isPaused: boolean;
              isPending: boolean;
              isSuccess: true;
              mutate: UseMutateFunction<ImportedReceipt, Error, void, unknown>;
              mutateAsync: UseMutateAsyncFunction<ImportedReceipt, Error, void, unknown>;
              reset: () => void;
              status: "success";
              submittedAt: number;
              variables: void;
          }

      • {
            context: unknown;
            data: undefined;
            error: null;
            failureCount: number;
            failureReason: Error | null;
            isError: false;
            isIdle: true;
            isPaused: boolean;
            isPending: boolean;
            isSuccess: false;
            mutate: UseMutateFunction<ImportedReceipt, Error, void, unknown>;
            mutateAsync: UseMutateAsyncFunction<ImportedReceipt, Error, void, unknown>;
            reset: () => void;
            status: "idle";
            submittedAt: number;
            variables: undefined;
        }
        • context: unknown
        • data: undefined

          The last successfully resolved data for the mutation.

        • error: null

          The error object for the mutation, if an error was encountered.

          • Defaults to null.
        • failureCount: number
        • failureReason: Error | null
        • isError: false

          A boolean variable derived from status.

          • true if the last mutation attempt resulted in an error.
        • isIdle: true

          A boolean variable derived from status.

          • true if the mutation is in its initial state prior to executing.
        • isPaused: boolean
        • isPending: boolean
        • isSuccess: false

          A boolean variable derived from status.

          • true if the last mutation attempt was successful.
        • mutate: UseMutateFunction<ImportedReceipt, Error, void, unknown>

          The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options.

          The variables object to pass to the mutationFn.

          This function will fire when the mutation is successful and will be passed the mutation's result.

          This function will fire if the mutation encounters an error and will be passed the error.

          This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error.

          • If you make multiple requests, onSuccess will fire only after the latest call you've made.
          • All the callback functions (onSuccess, onError, onSettled) are void functions, and the returned value will be ignored.
        • mutateAsync: UseMutateAsyncFunction<ImportedReceipt, Error, void, unknown>
        • reset: () => void

          A function to clean the mutation internal state (i.e., it resets the mutation to its initial state).

        • status: "idle"

          The status of the mutation.

          • Will be:
            • idle initial status prior to the mutation function executing.
            • pending if the mutation is currently executing.
            • error if the last mutation attempt resulted in an error.
            • success if the last mutation attempt was successful.
        • submittedAt: number
        • variables: undefined

          The variables object passed to the mutationFn.

      • {
            context: unknown;
            data: undefined;
            error: null;
            failureCount: number;
            failureReason: Error | null;
            isError: false;
            isIdle: false;
            isPaused: boolean;
            isPending: boolean;
            isSuccess: false;
            mutate: UseMutateFunction<ImportedReceipt, Error, void, unknown>;
            mutateAsync: UseMutateAsyncFunction<ImportedReceipt, Error, void, unknown>;
            reset: () => void;
            status: "pending";
            submittedAt: number;
            variables: void;
        }
        • context: unknown
        • data: undefined

          The last successfully resolved data for the mutation.

        • error: null

          The error object for the mutation, if an error was encountered.

          • Defaults to null.
        • failureCount: number
        • failureReason: Error | null
        • isError: false

          A boolean variable derived from status.

          • true if the last mutation attempt resulted in an error.
        • isIdle: false

          A boolean variable derived from status.

          • true if the mutation is in its initial state prior to executing.
        • isPaused: boolean
        • isPending: boolean
        • isSuccess: false

          A boolean variable derived from status.

          • true if the last mutation attempt was successful.
        • mutate: UseMutateFunction<ImportedReceipt, Error, void, unknown>

          The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options.

          The variables object to pass to the mutationFn.

          This function will fire when the mutation is successful and will be passed the mutation's result.

          This function will fire if the mutation encounters an error and will be passed the error.

          This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error.

          • If you make multiple requests, onSuccess will fire only after the latest call you've made.
          • All the callback functions (onSuccess, onError, onSettled) are void functions, and the returned value will be ignored.
        • mutateAsync: UseMutateAsyncFunction<ImportedReceipt, Error, void, unknown>
        • reset: () => void

          A function to clean the mutation internal state (i.e., it resets the mutation to its initial state).

        • status: "pending"

          The status of the mutation.

          • Will be:
            • idle initial status prior to the mutation function executing.
            • pending if the mutation is currently executing.
            • error if the last mutation attempt resulted in an error.
            • success if the last mutation attempt was successful.
        • submittedAt: number
        • variables: void

          The variables object passed to the mutationFn.

      • {
            context: unknown;
            data: undefined;
            error: Error;
            failureCount: number;
            failureReason: Error | null;
            isError: true;
            isIdle: false;
            isPaused: boolean;
            isPending: boolean;
            isSuccess: false;
            mutate: UseMutateFunction<ImportedReceipt, Error, void, unknown>;
            mutateAsync: UseMutateAsyncFunction<ImportedReceipt, Error, void, unknown>;
            reset: () => void;
            status: "error";
            submittedAt: number;
            variables: void;
        }
        • context: unknown
        • data: undefined

          The last successfully resolved data for the mutation.

        • error: Error

          The error object for the mutation, if an error was encountered.

          • Defaults to null.
        • failureCount: number
        • failureReason: Error | null
        • isError: true

          A boolean variable derived from status.

          • true if the last mutation attempt resulted in an error.
        • isIdle: false

          A boolean variable derived from status.

          • true if the mutation is in its initial state prior to executing.
        • isPaused: boolean
        • isPending: boolean
        • isSuccess: false

          A boolean variable derived from status.

          • true if the last mutation attempt was successful.
        • mutate: UseMutateFunction<ImportedReceipt, Error, void, unknown>

          The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options.

          The variables object to pass to the mutationFn.

          This function will fire when the mutation is successful and will be passed the mutation's result.

          This function will fire if the mutation encounters an error and will be passed the error.

          This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error.

          • If you make multiple requests, onSuccess will fire only after the latest call you've made.
          • All the callback functions (onSuccess, onError, onSettled) are void functions, and the returned value will be ignored.
        • mutateAsync: UseMutateAsyncFunction<ImportedReceipt, Error, void, unknown>
        • reset: () => void

          A function to clean the mutation internal state (i.e., it resets the mutation to its initial state).

        • status: "error"

          The status of the mutation.

          • Will be:
            • idle initial status prior to the mutation function executing.
            • pending if the mutation is currently executing.
            • error if the last mutation attempt resulted in an error.
            • success if the last mutation attempt was successful.
        • submittedAt: number
        • variables: void

          The variables object passed to the mutationFn.

      • {
            context: unknown;
            data: ImportedReceipt;
            error: null;
            failureCount: number;
            failureReason: Error | null;
            isError: false;
            isIdle: false;
            isPaused: boolean;
            isPending: boolean;
            isSuccess: true;
            mutate: UseMutateFunction<ImportedReceipt, Error, void, unknown>;
            mutateAsync: UseMutateAsyncFunction<ImportedReceipt, Error, void, unknown>;
            reset: () => void;
            status: "success";
            submittedAt: number;
            variables: void;
        }
        • context: unknown
        • data: ImportedReceipt

          The last successfully resolved data for the mutation.

        • error: null

          The error object for the mutation, if an error was encountered.

          • Defaults to null.
        • failureCount: number
        • failureReason: Error | null
        • isError: false

          A boolean variable derived from status.

          • true if the last mutation attempt resulted in an error.
        • isIdle: false

          A boolean variable derived from status.

          • true if the mutation is in its initial state prior to executing.
        • isPaused: boolean
        • isPending: boolean
        • isSuccess: true

          A boolean variable derived from status.

          • true if the last mutation attempt was successful.
        • mutate: UseMutateFunction<ImportedReceipt, Error, void, unknown>

          The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options.

          The variables object to pass to the mutationFn.

          This function will fire when the mutation is successful and will be passed the mutation's result.

          This function will fire if the mutation encounters an error and will be passed the error.

          This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error.

          • If you make multiple requests, onSuccess will fire only after the latest call you've made.
          • All the callback functions (onSuccess, onError, onSettled) are void functions, and the returned value will be ignored.
        • mutateAsync: UseMutateAsyncFunction<ImportedReceipt, Error, void, unknown>
        • reset: () => void

          A function to clean the mutation internal state (i.e., it resets the mutation to its initial state).

        • status: "success"

          The status of the mutation.

          • Will be:
            • idle initial status prior to the mutation function executing.
            • pending if the mutation is currently executing.
            • error if the last mutation attempt resulted in an error.
            • success if the last mutation attempt was successful.
        • submittedAt: number
        • variables: void

          The variables object passed to the mutationFn.