aws-amplify / aws-amplify/amplify-cli

Generating UI Components runs twice on amplify pull

Open
#12,716 1 comment 0 reactions 0 assignees View on GitHub
bug p2 platform-pull
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### 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:

- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.