Skip to content

Commit

Permalink
Reduce some bundle size bytes by removing strict null comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
desko27 committed Aug 23, 2024
1 parent 94087fc commit 6881d5a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/createCallable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function createCallable<Props = void, Response = void, RootProps = {}>(

return {
call: (props) => {
if ($setStack === null) throw new Error('No <Root> found!')
if (!$setStack) throw new Error('No <Root> found!')

const key = String($nextKey++)
let resolve: (value: Response | PromiseLike<Response>) => void
Expand Down Expand Up @@ -47,8 +47,7 @@ export function createCallable<Props = void, Response = void, RootProps = {}>(
const [stack, setStack] = useState<PrivateStackState<Props, Response>>([])

useEffect(() => {
if ($setStack !== null)
throw new Error('Multiple instances of <Root> found!')
if ($setStack) throw new Error('Multiple instances of <Root> found!')
$setStack = setStack
return () => {
$setStack = null
Expand Down

0 comments on commit 6881d5a

Please sign in to comment.