Add multi-use vs one-time registration code controls on add device.#1122
Add multi-use vs one-time registration code controls on add device.#1122evanrbowers wants to merge 1 commit into
Conversation
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>
|
@codex review |
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
There was a problem hiding this comment.
💡 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, |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 👍 / 👎.
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