Xstate: `data` function is executed before machine enters final state.

Created on 17 Mar 2020  路  4Comments  路  Source: davidkpiano/xstate

Description
data function is executed before machine enters final state.

Expected Result
data function should be executed after machine enters final state.

Reproduction
https://codesandbox.io/s/vibrant-chandrasekhar-v8q61

Additional context
Maybe this behavior is expected. I'm trying to validate output data here. But it is impossible if this function is executed earlier.

Thanks

bug 馃搼 SCXML

All 4 comments

Is there any other way to send such data? Right now I have to fill whole context object to avoid errors while reading nested objects.

Thanks

Please be patient, you have opened your issue yesterday - we all have lives and are doing this in our free time, getting an answer might take a couple of days (and that's normal).

I'll look into this in the following days to see what's going on.

@Andarist Sorry if my comment sound this way. I was just wondering if there is any quick workaround that you are aware of. It was not my intention to rush anyone.
Thank you for your help and have a nice day :)

@RafalFilipek No workaround yet; you can set a small delay to go to the final state, although that might not be the ideal solution.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

greggman picture greggman  路  3Comments

doup picture doup  路  3Comments

hnordt picture hnordt  路  3Comments

rodinhart picture rodinhart  路  3Comments

bradwoods picture bradwoods  路  3Comments