aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.83k stars 822 forks source link

Generating UI Components runs twice on amplify pull #12716

Open letsbelopez opened 1 year ago

letsbelopez commented 1 year ago

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

16.20.0

Amplify CLI Version

12.0.0

What operating system are you using?

Mac

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No

Describe the bug

Recently when I have done an amplify pull, The Generating UI Components event runs twice in a row.

Here is the event handler: https://github.com/aws-amplify/amplify-cli/blob/dev/packages/amplify-util-uibuilder/src/event-handlers/handle-PostPull.ts#L10

Here is the function that's running twice: https://github.com/aws-amplify/amplify-cli/blob/dev/packages/amplify-util-uibuilder/src/commands/generateComponents.ts#L26

Expected behavior

It should only run once. The plugin is registered for a PostPush and PostPull event.

Reproduction steps

  1. Run amplify pull in an app that contains ui components to generate.
  2. You can double check ui components should generate be passing this check: https://github.com/aws-amplify/amplify-cli/blob/dev/packages/amplify-util-uibuilder/src/commands/generateComponents.ts#L42
  3. And passing this check: https://github.com/aws-amplify/amplify-cli/blob/dev/packages/amplify-util-uibuilder/src/commands/utils/shouldRenderComponents.ts#L10
  4. You should see this spinner run twice in a row ihttps://github.com/aws-amplify/amplify-cli/blob/dev/packages/amplify-util-uibuilder/src/commands/generateComponents.ts#L46

Project Identifier

No response

Log output

``` # Put your logs below this line ```

Additional information

I can add a user to the app to make it easier to setup to debug. I just need an email address. Other events may be impacted and running twice as well.

Before submitting, please confirm:

ykethan commented 1 year ago

Hey @letsbelopez, observed this behaviour as well. marking as bug.