프로시저 호출 중단
비공식 베타 번역
이 페이지는 PageTurner AI로 번역되었습니다(베타). 프로젝트 공식 승인을 받지 않았습니다. 오류를 발견하셨나요? 문제 신고 →
tRPC는 프로시저 중단과 관련해 업계 표준을 따릅니다. 쿼리 또는 뮤테이션 옵션에 AbortSignal을 전달하고, 요청을 취소해야 할 경우 AbortController 인스턴스의 abort 메서드를 호출하기만 하면 됩니다.
utils.tsts// @filename: server.tsimport {createTRPCClient ,httpBatchLink } from '@trpc/client';import type {AppRouter } from './server.ts';constproxy =createTRPCClient <AppRouter >({links : [httpBatchLink ({url : 'http://localhost:3000/trpc',}),],});// 1. Create an AbortController instance - this is a standard javascript APIconstac = newAbortController ();// 2. Pass the signal to a query or mutationconstquery =proxy .userById .query ('id_bilbo', {signal :ac .signal });// 3. Cancel the request if neededac .abort ();
utils.tsts// @filename: server.tsimport {createTRPCClient ,httpBatchLink } from '@trpc/client';import type {AppRouter } from './server.ts';constproxy =createTRPCClient <AppRouter >({links : [httpBatchLink ({url : 'http://localhost:3000/trpc',}),],});// 1. Create an AbortController instance - this is a standard javascript APIconstac = newAbortController ();// 2. Pass the signal to a query or mutationconstquery =proxy .userById .query ('id_bilbo', {signal :ac .signal });// 3. Cancel the request if neededac .abort ();