Skip to content

[email protected]

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 04 Aug 15:09
· 518 commits to main since this release
0c3bf27

Minor Changes

  • #4145 5cc902531 Thanks @davidkpiano! - Significant improvements to error handling have been made:

    • Actors will no longer crash when an error is thrown in an observer (actor.subscribe(observer)).
    • Errors will be handled by observer's .error() handler:
      actor.subscribe({
        error: (error) => {
          // handle error
        }
      });
    • If an observer does not have an error handler, the error will be thrown in a clear stack so bug tracking services can collect it.
  • #4054 a24711181 Thanks @davidkpiano! - Input types can now be specified for machines:

    const emailMachine = createMachine({
      types: {} as {
        input: {
          subject: string;
          message: string;
        };
      },
      context: ({ input }) => ({
        // Strongly-typed input!
        emailSubject: input.subject,
        emailBody: input.message.trim()
      })
    });
    
    const emailActor = interpret(emailMachine, {
      input: {
        // Strongly-typed input!
        subject: 'Hello, world!',
        message: 'This is a test.'
      }
    }).start();