-
Notifications
You must be signed in to change notification settings - Fork 888
feat: give users ability to duplicate existing workspaces #10195
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
Conversation
There's a flaky test for this part of the codebase that seems to have flared up after the recent auth refactor. Going to see what I can do to pinpoint the source |
</FormFields> | ||
</FormSection> | ||
<> | ||
{mode === "duplicate" && <DuplicateWarningMessage />} |
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.
The only thing that changed for the return value is that the component now returns a React Fragment, so that the DuplicateWarningMessage
component can conditionally render. Everything else is a change in indentation level
); | ||
}; | ||
|
||
type ExternalAuthErrors = Record<string, string>; | ||
function getAuthErrors( |
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 replaces the useExternalAuthVerification
hook. All its values could be derived from existing state, and I'm always cagey about introducing more state, since there's more chances for things to get out of sync
|
||
const CreateWorkspacePage: FC = () => { | ||
const organizationId = useOrganizationId(); | ||
const [searchParams] = useSearchParams(); |
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.
Sorry for all the shuffling around, but I generally think it's better to keep all the hook calls at the top of the component, instead of mingling them with derived values that aren't necessary for other hook calls
Much easier to avoid Rules of Hooks violations
@@ -38,7 +41,7 @@ const isValidValue = ( | |||
return true; | |||
}; | |||
|
|||
export const useValidationSchemaForRichParameters = ( | |||
export const validateRichParameters = ( |
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.
Updated the name because it felt like it could mislead someone into thinking it's a React hook
* Buttons supported by workspace actions. Canceling, Deleted, and Pending | ||
* should all be associated with disabled states | ||
*/ | ||
export type ButtonType = |
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.
Wanted to get rid of the enum, just because they can have weird edge case behavior at runtime. It also felt like one of the benefits was making it more clear that the majority of these types are synced with the WorkspaceStatus type
<StartButton workspace={workspace} handleAction={handleStart} /> | ||
), | ||
[ButtonTypesEnum.starting]: ( | ||
update: <UpdateButton handleAction={handleUpdate} />, |
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.
Nothing major changed with the buttonMapping
variable. Just got rid of the enum keys
Addresses the UI portion of #9923