#[v5] order of entry and invoke

1 messages · Page 1 of 1 (latest)

haughty palm
#

It seems entry actions run after invoke.input gets resolved. Is that the desired behavior or a bug?

createMachine({
  context: {
    next: 'next',
    current: null
  },
  initial: 'process',
  states: {
    process: {
      entry: [assign(({context}) => {
        return {
          current: context.next,
          next: null,
        }
      })],
      invoke: {
        input: ({context}) => context.current,
        src: fromPromise(async ({input}) =>  {
          // ❌ expected input to be "next" but it is null.
        })
      },
    },
  }
});
swift spade
#

Goooood question (cc. @neon plover)

neon plover
#

related thread: #scxml message

#

i'll just try to implement a change that was mentioned there (i think?) tomorrow~

#

with that change the input should receive the updated context value

neon plover
#

I made some progress on this today but now a flu got me - so this change will have to wait till after the weekend