Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: VSCode plugin error "<action> is never used in the machine definition" #373

Open
jluxenberg opened this issue Sep 27, 2023 · 3 comments · May be fixed by #395
Open

Bug: VSCode plugin error "<action> is never used in the machine definition" #373

jluxenberg opened this issue Sep 27, 2023 · 3 comments · May be fixed by #395
Labels
bug Something isn't working

Comments

@jluxenberg
Copy link

Description

Consider this machine definition:

import { createMachine, assign } from 'xstate';

export const machine = 
  createMachine(
    {
      tsTypes: {} as import("./machine.typegen").Typegen0,
      id: 'machine',
      initial: 'initial',
      states: {
        initial: {
          entry: [{type: 'action1'}],
        },
      },
      predictableActionArguments: true,
      preserveActionOrder: true,
    },
    {
      actions: {
        action1: (_, event) => {
            console.log("action1", event);
        },
      },
    },
  );

Expected result

I expected to see no errors; the plugin should be aware of the use of action1.

Actual result

I get an error on line 19 "action1 is never used in the machine definition":

CleanShot 2023-09-27 at 14 49 41

Reproduction

N/A ; only occurs in the VSCode plugin

Additional context

No response

@jluxenberg jluxenberg added the bug Something isn't working label Sep 27, 2023
@davidkpiano davidkpiano transferred this issue from statelyai/xstate Sep 27, 2023
@with-heart with-heart linked a pull request Nov 8, 2023 that will close this issue
@Jordan-Eckowitz
Copy link

I'm seeing something similar with guards. When I changed the guarded transition key from cond to guard as a part of the v5 migration it now always shows guards as unused.

ref: https://stately.ai/docs/migration#guarded-transitions-use-guard-not-cond

@davidkpiano
Copy link
Member

I'm seeing something similar with guards. When I changed the guarded transition key from cond to guard as a part of the v5 migration it now always shows guards as unused.

ref: https://stately.ai/docs/migration#guarded-transitions-use-guard-not-cond

We still need to update the extension to be v5-aware; that's in progress (cc. @farskid @Andarist)

@nadavhalfon
Copy link

Oh Ok, do you have any schedule for that? (even an estimation)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants