Skip to content

deriving fsm #8

Closed
Closed
@astanet

Description

@astanet

Thanks for publishing this great module.

I want to make a derived store from fsm.

	const simpleSwitch = fsm('off', {
		off: { toggle: 'on' },
		on: { toggle: 'off' }
	});

	$: isOnReactive = $simpleSwitch === 'on' // this works
	const isOnDerived = derived(simpleSwitch, $simpleSwitch => $simpleSwitch === 'on') // this doesn't

Please take a look the following repl.
https://svelte.dev/repl/5448ab6468704700ae1c2db736a0ac44?version=3.48.0

Accessing derived store from fsm with $ causes this error.
Cannot read properties of undefined (reading 'unsubscribe')

Please let me know if I am wrong in any way.
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions