#createActorContext interpreter options

1 messages · Page 1 of 1 (latest)

night lava
#

hi - I'm really loving the reduction in boiler plate with createActorContext. I've just one question though - does anyone know where can I set the interpreter options such as devTools?

grand tundra
#

You can use withConfig.

createActorContext(machine.withConfig(options))
night lava
#

Awesome thanks Farzad 🙂

#

hmm I'm seeing

Argument of type '{ devTools: boolean; }' is not assignable to parameter of type 'InternalMachineOptions.....```

for 

const s = createMachine({}).withConfig({ devTools: true });
export const SearchContext = createActorContext(s);

shell mesa
#

Should the {devTool: true} not be the second parameter to createMachine(...) i.e. createMachine({},{devTool:true}).withContext(...)

grand tundra
#

I don't think there's a way to pass interpreter options to createActorContext's interpreter. I might open a PR to address that.

shell mesa
#

Actually I was thinking of useMachine not createMachine like this const [state, send, service] = useMachine(registrationFormMachine, { devTools: true }); My bad

grand tundra
whole lagoon
grand tundra
#

This is merged and will be available with the next version of @xstate/react.

night lava
#

fabulous! ⭐

whole lagoon
#

This is released ✅

kind brook
#

Is there still no way to pass/override options to an interpreted machine that is created outside of react?

I usually I find that I need access to the same actor (interpreted machine) from inside and outside of components, but that's not possible right?