-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Fleet] Fix staleness bug in "Add agent" flyout #103095
[Fleet] Fix staleness bug in "Add agent" flyout #103095
Conversation
* Refactored naming
… state sync issues
Pinging @elastic/fleet (Team:Fleet) |
|
||
setEnrollmentAPIKeys(enrollmentAPIKeysResponse); | ||
// Default to the first the first enrollment key if there is one. | ||
onKeyChange(enrollmentAPIKeysResponse[0]?.id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is the fix for the bug in the linked issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit on a typo otherwise LGTM 🚀
); | ||
|
||
setEnrollmentAPIKeys(enrollmentAPIKeysResponse); | ||
// Default to the first the first enrollment key if there is one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment has a typo. "The first" appears twice.
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
* * Fix stale enrollment api token bug * Refactored naming * raise the state of the selected enrollment api key to parent to avoid state sync issues * removed consts for onKeyChange and selectedApiKeyId * fix typo Co-authored-by: Kibana Machine <[email protected]>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
* * Fix stale enrollment api token bug * Refactored naming * raise the state of the selected enrollment api key to parent to avoid state sync issues * removed consts for onKeyChange and selectedApiKeyId * fix typo Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Jean-Louis Leysens <[email protected]>
Hi @EricDavisX
Build details:
Thanks |
Summary
Fix #102863. Looks like a regression from #101576.
How to test
See the linked issue for more details.
To reviewers
This contribution refactors how some of the state is managed in the "Add agent" flyout. Currently the state management uses callbacks only with nested child state values that need to call the callbacks to keep the parent component's state in sync. This can lead to staleness bugs if we refactor these components, as was recently done, and do not propagate state correctly back up to the parent (single source of truth).
Happy to leave these changes out though if it introduces too much volatility since it is another refactor!
Checklist
For now, manual testing is done per the PR description.
Risk Matrix
Delete this section if it is not applicable to this PR.
Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.
When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:
For maintainers