Minor Changes
-
#4184
a741fe7Thanks @davidkpiano! - Added routable states. States withroute: {}and an explicitidcan be navigated to from anywhere via a single{ type: 'xstate.route', to: '#id' }event.const machine = setup({}).createMachine({ id: 'app', initial: 'home', states: { home: { id: 'home', route: {} }, dashboard: { initial: 'overview', states: { overview: { id: 'overview', route: {} }, settings: { id: 'settings', route: {} } } } } }); const actor = createActor(machine).start(); // Route directly to deeply nested state from anywhere actor.send({ type: 'xstate.route', to: '#settings' });
Routes support guards for conditional navigation:
settings: { id: 'settings', route: { guard: ({ context }) => context.role === 'admin' } }
Patch Changes
- #5464
ad809a0Thanks @davidkpiano! - Fix: export types so setup() declaration emit works (fixes #5462)