Remove serverless functions on version archivation (#9535)
Fixes https://github.com/twentyhq/core-team-issues/issues/52 - contrary to title, we do not remove serverless functions on workflow version archivation because serverless fucntion might be used in another workflow version - we fix the serverless funciton version displayed in the code step - we allow test function version in step display right drawer - we delete serverless function only when serverless function has no published version
This commit is contained in:
@ -36,7 +36,7 @@ describe('useServerlessFunctionUpdateFormState', () => {
|
||||
},
|
||||
);
|
||||
const { result } = renderHook(
|
||||
() => useServerlessFunctionUpdateFormState(serverlessFunctionId),
|
||||
() => useServerlessFunctionUpdateFormState({ serverlessFunctionId }),
|
||||
{
|
||||
wrapper: RecoilRoot,
|
||||
},
|
||||
|
||||
@ -20,9 +20,13 @@ type SetServerlessFunctionFormValues = Dispatch<
|
||||
SetStateAction<ServerlessFunctionFormValues>
|
||||
>;
|
||||
|
||||
export const useServerlessFunctionUpdateFormState = (
|
||||
serverlessFunctionId: string,
|
||||
): {
|
||||
export const useServerlessFunctionUpdateFormState = ({
|
||||
serverlessFunctionId,
|
||||
serverlessFunctionVersion = 'draft',
|
||||
}: {
|
||||
serverlessFunctionId: string;
|
||||
serverlessFunctionVersion?: string;
|
||||
}): {
|
||||
formValues: ServerlessFunctionFormValues;
|
||||
setFormValues: SetServerlessFunctionFormValues;
|
||||
loading: boolean;
|
||||
@ -43,7 +47,7 @@ export const useServerlessFunctionUpdateFormState = (
|
||||
|
||||
const { loading } = useGetOneServerlessFunctionSourceCode({
|
||||
id: serverlessFunctionId,
|
||||
version: 'draft',
|
||||
version: serverlessFunctionVersion,
|
||||
onCompleted: (data: FindOneServerlessFunctionSourceCodeQuery) => {
|
||||
const newState = {
|
||||
code: data?.getServerlessFunctionSourceCode || undefined,
|
||||
|
||||
Reference in New Issue
Block a user