- remove asynchronous serverless function build - build serverless function synchronously instead on activate workflow or execute - add a loader on workflow code step test tab test button - add a new `ServerlessFunctionSyncStatus` `BUILDING` - add a new route to build a serverless function draft version - delay artificially execution to avoid UI flashing https://github.com/user-attachments/assets/8d958d9a-ef41-4261-999e-6ea374191e33
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { useQuery } from '@apollo/client';
|
|
import { useApolloMetadataClient } from '@/object-metadata/hooks/useApolloMetadataClient';
|
|
import { FIND_ONE_SERVERLESS_FUNCTION_SOURCE_CODE } from '@/settings/serverless-functions/graphql/queries/findOneServerlessFunctionSourceCode';
|
|
import {
|
|
FindOneServerlessFunctionSourceCodeQuery,
|
|
FindOneServerlessFunctionSourceCodeQueryVariables,
|
|
} from '~/generated-metadata/graphql';
|
|
|
|
export const useGetOneServerlessFunctionSourceCode = ({
|
|
id,
|
|
version,
|
|
onCompleted,
|
|
}: {
|
|
id: string;
|
|
version: string;
|
|
onCompleted?: (data: FindOneServerlessFunctionSourceCodeQuery) => void;
|
|
}) => {
|
|
const apolloMetadataClient = useApolloMetadataClient();
|
|
const { data, loading } = useQuery<
|
|
FindOneServerlessFunctionSourceCodeQuery,
|
|
FindOneServerlessFunctionSourceCodeQueryVariables
|
|
>(FIND_ONE_SERVERLESS_FUNCTION_SOURCE_CODE, {
|
|
client: apolloMetadataClient ?? undefined,
|
|
variables: {
|
|
input: { id, version },
|
|
},
|
|
onCompleted,
|
|
fetchPolicy: 'network-only',
|
|
});
|
|
return { code: data?.getServerlessFunctionSourceCode, loading };
|
|
};
|