From 99dbbdebfeec82fd757cb7045030d48357dd6370 Mon Sep 17 00:00:00 2001 From: Ismael Ramon Date: Mon, 2 Dec 2024 12:51:23 +0100 Subject: [PATCH] Add index and stackSize properties to CallContext --- lib/createCallable/index.tsx | 3 ++- lib/createCallable/types.ts | 2 +- src/CallableScenes/YourNested.tsx | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/createCallable/index.tsx b/lib/createCallable/index.tsx index f0fce43..94be91a 100644 --- a/lib/createCallable/index.tsx +++ b/lib/createCallable/index.tsx @@ -62,7 +62,8 @@ export function createCallable( call={{ ...call, root: rootProps, - stack: { index, size: stack.length }, + index, + stackSize: stack.length, }} /> )) diff --git a/lib/createCallable/types.ts b/lib/createCallable/types.ts index 1660f3e..bab8f9b 100644 --- a/lib/createCallable/types.ts +++ b/lib/createCallable/types.ts @@ -23,7 +23,7 @@ export type CallFunction = (props: Props) => Promise export type CallContext = Omit< PrivateCallContext, 'props' -> & { root: RootProps; stack: { index: number; size: number } } +> & { root: RootProps; index: number; stackSize: number } /** * User props + the call prop diff --git a/src/CallableScenes/YourNested.tsx b/src/CallableScenes/YourNested.tsx index 7cf6239..107efd0 100644 --- a/src/CallableScenes/YourNested.tsx +++ b/src/CallableScenes/YourNested.tsx @@ -23,7 +23,7 @@ export const YourNested = createCallable< if (!isMounted) onCallNested(i) }, []) - if (call.stack.index < call.stack.size - DOM_LIMIT_TO_VIRTUALIZE) return null + if (call.index < call.stackSize - DOM_LIMIT_TO_VIRTUALIZE) return null return (