Skip to content

Commit

Permalink
fix: undefined exceptions
Browse files Browse the repository at this point in the history
Despite the types saying these things can't be undefined, there are error reports of them being undefined
  • Loading branch information
UberMouse committed Aug 17, 2023
1 parent d8d42fb commit 086e6a3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/xstateTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export function XstateTreeView({ interpreter }: XStateTreeViewProps) {
// This is needed because the inState function needs to be recreated if the
// current state the machine is in changes. But _only_ then
// eslint-disable-next-line react-hooks/exhaustive-deps
[current.value]
[current?.value]
);
const selectorsProxy = useConstant(() => {
return new Proxy(
Expand Down Expand Up @@ -294,7 +294,7 @@ export function recursivelySend<
) as unknown as Interpreter<any, any, any, any>[];

// If the service can't handle the event, don't send it
if (service.state.nextEvents.includes((event as any).type)) {
if (service.getSnapshot()?.nextEvents.includes((event as any).type)) {
try {
service.send(event as any);
} catch (e) {
Expand Down

0 comments on commit 086e6a3

Please sign in to comment.