Skip to content

Commit

Permalink
Add index and stackSize properties to CallContext
Browse files Browse the repository at this point in the history
  • Loading branch information
desko27 committed Dec 2, 2024
1 parent a57afce commit 99dbbde
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/createCallable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ export function createCallable<Props = void, Response = void, RootProps = {}>(
call={{
...call,
root: rootProps,
stack: { index, size: stack.length },
index,
stackSize: stack.length,
}}
/>
))
Expand Down
2 changes: 1 addition & 1 deletion lib/createCallable/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export type CallFunction<Props, Response> = (props: Props) => Promise<Response>
export type CallContext<Props, Response, RootProps> = Omit<
PrivateCallContext<Props, Response>,
'props'
> & { root: RootProps; stack: { index: number; size: number } }
> & { root: RootProps; index: number; stackSize: number }

/**
* User props + the call prop
Expand Down
2 changes: 1 addition & 1 deletion src/CallableScenes/YourNested.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Dialog color="pink" ended={call.ended}>
Expand Down

0 comments on commit 99dbbde

Please sign in to comment.