Skip to content

Bug: Display difficulties when splitting machine into multible files #497

Description

@ohjah

XState version

XState version 5

Description

i have a very complex global state machine. to make it more readable and editable i want to split the code into multible files, import the independet parts and init the machine.
when i have all parts in one big file it works fine and the xstate extension can easyly show me what my statechart looks like but when i put the parts in different files and import them it just shows me an empty box.

ps: i dont want to invoke or spwan actors to split the machine. i already tried this and because context between actors is isolated this does not work for me.

ps: im using xstate with react

basic example:

export const authenticationStates = {
	initial: 'unauthenticated',
	states: {
		unauthenticated: {
			on: { REGISTER_USER: 'authenticated' }
		},
		authenticated: {
			on: { LOGOUT_USER: 'unauthenticated' }
		}
	}
};
setup({
	types: {
		events: {} as authEvents,
		context: {} as {
			auth: authenticationContextType;
		}
	}
}).createMachine({
	id: 'global',
	type: 'parallel',
	context: { auth: authenticationContext },
	states: {
		auth: authenticationStates
	}
});

Expected result

image

Actual result

image

Reproduction

i dont think that is nessesary in this case. if needed i submit later

Additional context

i cannot tell yet but i think it still works but the xstate extenstion defently has problems to display the statechart

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions