fmt
This commit is contained in:
		@ -2,7 +2,9 @@ import { InteractionMapMachineContext } from 'components/InteractionMapMachinePr
 | 
			
		||||
 | 
			
		||||
export const useInteractionMapContext = () => {
 | 
			
		||||
  const interactionMapActor = InteractionMapMachineContext.useActorRef()
 | 
			
		||||
  const interactionMapState = InteractionMapMachineContext.useSelector((state) => state)
 | 
			
		||||
  const interactionMapState = InteractionMapMachineContext.useSelector(
 | 
			
		||||
    (state) => state
 | 
			
		||||
  )
 | 
			
		||||
  return {
 | 
			
		||||
    actor: interactionMapActor,
 | 
			
		||||
    send: interactionMapActor.send,
 | 
			
		||||
 | 
			
		||||
@ -229,14 +229,13 @@ export const interactionMapMachine = setup({
 | 
			
		||||
            reject()
 | 
			
		||||
          } else {
 | 
			
		||||
            // return the last-added, available exact match
 | 
			
		||||
          resolve(
 | 
			
		||||
            availableExactMatches[availableExactMatches.length - 1][1]
 | 
			
		||||
          )
 | 
			
		||||
            resolve(availableExactMatches[availableExactMatches.length - 1][1])
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
      }
 | 
			
		||||
    ),
 | 
			
		||||
    'Execute keymap action': fromPromise(async ({ input }: { input: InteractionMapItem}) => {
 | 
			
		||||
    'Execute keymap action': fromPromise(
 | 
			
		||||
      async ({ input }: { input: InteractionMapItem }) => {
 | 
			
		||||
        try {
 | 
			
		||||
          console.log('Executing action', input)
 | 
			
		||||
          input.action()
 | 
			
		||||
@ -244,11 +243,15 @@ export const interactionMapMachine = setup({
 | 
			
		||||
          console.error(error)
 | 
			
		||||
          toast.error('There was an error executing the action.')
 | 
			
		||||
        }
 | 
			
		||||
    }),
 | 
			
		||||
      }
 | 
			
		||||
    ),
 | 
			
		||||
  },
 | 
			
		||||
  guards: {
 | 
			
		||||
    'There are prefix matches': ({ event }) => {
 | 
			
		||||
      return event.type === 'xstate.error.actor.resolveHotkeyByPrefix'  && event.data !== undefined
 | 
			
		||||
      return (
 | 
			
		||||
        event.type === 'xstate.error.actor.resolveHotkeyByPrefix' &&
 | 
			
		||||
        event.data !== undefined
 | 
			
		||||
      )
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
}).createMachine({
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user