mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
chore(site): fix reset password storybook flake (#15380)
Fix https://github.com/coder/internal/issues/69
This commit is contained in:
@ -72,6 +72,9 @@ const meta: Meta<typeof UsersPage> = {
|
||||
component: UsersPage,
|
||||
parameters,
|
||||
decorators: [withGlobalSnackbar, withAuthProvider, withDashboardProvider],
|
||||
args: {
|
||||
defaultNewPassword: "edWbqYiaVpEiEWwI",
|
||||
},
|
||||
};
|
||||
|
||||
export default meta;
|
||||
|
@ -35,7 +35,13 @@ import { ResetPasswordDialog } from "./ResetPasswordDialog";
|
||||
import { useStatusFilterMenu } from "./UsersFilter";
|
||||
import { UsersPageView } from "./UsersPageView";
|
||||
|
||||
const UsersPage: FC = () => {
|
||||
type UserPageProps = {
|
||||
// Used by Storybook to prevent generating a new password each time the story
|
||||
// loads, avoiding Chromatic snapshot differences.
|
||||
defaultNewPassword?: string;
|
||||
};
|
||||
|
||||
const UsersPage: FC<UserPageProps> = ({ defaultNewPassword }) => {
|
||||
const queryClient = useQueryClient();
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
@ -134,7 +140,7 @@ const UsersPage: FC = () => {
|
||||
onResetUserPassword={(user) => {
|
||||
setConfirmResetPassword({
|
||||
user,
|
||||
newPassword: generateRandomString(12),
|
||||
newPassword: defaultNewPassword ?? generateRandomString(12),
|
||||
});
|
||||
}}
|
||||
onUpdateUserRoles={async (userId, roles) => {
|
||||
|
@ -34,7 +34,6 @@ const meta: Meta<typeof UsersPageView> = {
|
||||
isNonInitialPage: false,
|
||||
users: [MockUser, MockUser2],
|
||||
roles: MockAssignableSiteRoles,
|
||||
|
||||
canEditUsers: true,
|
||||
filterProps: defaultFilterProps,
|
||||
authMethods: MockAuthMethodsPasswordOnly,
|
||||
|
Reference in New Issue
Block a user