Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3flippa opened this issue Nov 12, 2024 · 2 comments
Open
Labels
bug Something isn't working

Comments

@3flippa
Copy link

3flippa commented Nov 12, 2024

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

@3flippa 3flippa added the bug Something isn't working label Nov 12, 2024
@davidkpiano davidkpiano transferred this issue from statelyai/xstate Nov 12, 2024
@davidkpiano
Copy link
Member

davidkpiano commented Nov 19, 2024

The VSCode extension does not currently support state machines spread out in multiple files.

@3flippa 3flippa changed the title Bug: Display difficulties when Bug: Display difficulties when splitting machine into multible files Nov 28, 2024
@3flippa
Copy link
Author

3flippa commented Nov 28, 2024

ok i can now surely say that the state machine is still working. its just not displayed by xstate tooling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants