Skip to content

Commit beac171

Browse files
committed
⏪️ (docs): add back comments lost in merge
1 parent 1c51ace commit beac171

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/context/GRPCProvider.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,19 @@ const getInterceptors = (logger: ReturnType<typeof useLogger>) => {
2727
return [loggerInterceptor];
2828
};
2929

30+
// Create gRPC-web transport with the given configuration.
3031
const getWebTransport = (endpoint: string) =>
3132
createGrpcWebTransport({
3233
baseUrl: endpoint,
33-
credentials: 'include', // necessary for authentication to be set
34+
credentials: 'include', // Necessary for authentication to be set.
3435
});
3536

3637
/**
3738
* Props for the GRPCProvider component.
3839
*/
3940
export interface GRPCProviderProps extends PropsWithChildren {
40-
endpoint?: string;
41-
useDefaultReactQueryProvider?: boolean;
41+
endpoint?: string; // Optional - overrides endpoint to use for the gRPC-web transport.
42+
useDefaultReactQueryProvider?: boolean; // Whether to use the default React Query Provider.
4243
}
4344

4445
/**
@@ -49,12 +50,13 @@ export interface GRPCProviderProps extends PropsWithChildren {
4950
* @returns The component wrapped with the TransportProvider and optionally the QueryClientProvider.
5051
*/
5152
export function GRPCProvider({
52-
endpoint = GRPC_ENDPOINT,
53-
useDefaultReactQueryProvider = true,
53+
endpoint = GRPC_ENDPOINT, // Default to the Production Trade-API endpoint.
54+
useDefaultReactQueryProvider = true, // Default to true to use the QueryClientProvider.
5455
children,
5556
}: GRPCProviderProps) {
5657
const logger = useLogger(); // Use the logger context.
5758
const transport: Transport = useMemo(() => {
59+
// Memoize the transport to avoid unnecessary re-renders.
5860
return {
5961
...getWebTransport(endpoint),
6062
interceptors: getInterceptors(logger),

0 commit comments

Comments
 (0)