Skip to content

Commit

Permalink
Clear role diff attempt on role editor close (#52696)
Browse files Browse the repository at this point in the history
This fixes an issue where someone could see stale data when attempting
to create a new role after editing a previous one
  • Loading branch information
avatus authored Mar 3, 2025
1 parent 42f5c21 commit e2fe2e8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion web/packages/teleport/src/Roles/Roles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ type RoleDiffProps = {
// TODO(bl-nero): Make this property required once the Enterprise code is
// updated.
roleDiffAttempt?: Attempt<unknown>;
clearRoleDiffAttempt?: () => void;
};

export type RolesProps = {
Expand Down Expand Up @@ -239,7 +240,10 @@ export function Roles(props: State & RolesProps) {
open={
resources.status === 'creating' || resources.status === 'editing'
}
onClose={resources.disregard}
onClose={() => {
resources.disregard();
props.roleDiffProps?.clearRoleDiffAttempt();
}}
resources={resources}
onSave={handleSave}
roleDiffProps={props.roleDiffProps}
Expand Down

0 comments on commit e2fe2e8

Please sign in to comment.