Skip to content

Add multi-use vs one-time registration code controls on add device.#1122

Open
evanrbowers wants to merge 1 commit into
mainfrom
registration-code-updates
Open

Add multi-use vs one-time registration code controls on add device.#1122
evanrbowers wants to merge 1 commit into
mainfrom
registration-code-updates

Conversation

@evanrbowers

Copy link
Copy Markdown
Contributor

Update existing registration codes in place when options change, keep the command visible during updates, and add a chip toggle for one-time use on the platform add page.

Changes

Update existing registration codes in place when options change, keep the command visible during updates, and add a chip toggle for one-time use on the platform add page.

Co-authored-by: Cursor <cursoragent@cursor.com>
@evanrbowers

Copy link
Copy Markdown
Contributor Author

@codex review

@aws-amplify-us-west-1

Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-1122.d20k671nqqv4kl.amplifyapp.com

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a730c0b915

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

accountId,
services: serviceTypes.map(type => ({ application: type })),
oneTimeUse,
code: registrationCode,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not reuse stale registration codes across sessions

Because registrationCode is global UI state and the unmount cleanup below only clears registrationCommand, this line sends whatever code was generated by a previous useAutoRegistration mount. After a user leaves an Add Device page and later opens another platform/add flow in the same session, the new GraphQL request is made with the old code, so the backend can reuse/update that previous registration instead of creating a fresh one for the new flow. Clear the code on cleanup or track that the code belongs to this hook instance before passing it back.

Useful? React with 👍 / 👎.

alignItems={{ xs: 'flex-start', md: 'flex-end' }}
/>
<Stack alignItems={{ xs: 'flex-start', md: 'flex-end' }} marginTop={2}>
<Chip

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Wire the one-time toggle into override registrations

This chip is rendered for every platform with installation.command, including Cachengo (frontend/src/platforms/cachengo/index.tsx:15-16), but the override render path below does not receive oneTimeUse and RentANodeRequest calls useAutoRegistration without it. In the Cachengo Add Device flow, clicking the chip only changes the local label and the registration request still sends no one-time setting.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant