Fix state mutation serverless action (#8580)
In this PR: - Ensure the `setNestedValue` does a deep copy of the provided object and doesn't mutate it directly. - Store the form's state in a `useState` instead of relying entirely on the backend's state. This makes the form more resilient to slow network connections. - Ensure the input settings are reset when selecting another function. - The Inner component now expects the serverless functions data to be resolved before being mounted, so I split it. Closes https://github.com/twentyhq/twenty/issues/8523
This commit is contained in:
committed by
GitHub
parent
a744515303
commit
c133129eb0
@ -1,6 +1,6 @@
|
||||
import { useQuery } from '@apollo/client';
|
||||
import { FIND_MANY_SERVERLESS_FUNCTIONS } from '@/settings/serverless-functions/graphql/queries/findManyServerlessFunctions';
|
||||
import { useApolloMetadataClient } from '@/object-metadata/hooks/useApolloMetadataClient';
|
||||
import { FIND_MANY_SERVERLESS_FUNCTIONS } from '@/settings/serverless-functions/graphql/queries/findManyServerlessFunctions';
|
||||
import { useQuery } from '@apollo/client';
|
||||
import {
|
||||
GetManyServerlessFunctionsQuery,
|
||||
GetManyServerlessFunctionsQueryVariables,
|
||||
@ -8,13 +8,17 @@ import {
|
||||
|
||||
export const useGetManyServerlessFunctions = () => {
|
||||
const apolloMetadataClient = useApolloMetadataClient();
|
||||
const { data } = useQuery<
|
||||
|
||||
const { data, loading, error } = useQuery<
|
||||
GetManyServerlessFunctionsQuery,
|
||||
GetManyServerlessFunctionsQueryVariables
|
||||
>(FIND_MANY_SERVERLESS_FUNCTIONS, {
|
||||
client: apolloMetadataClient ?? undefined,
|
||||
});
|
||||
|
||||
return {
|
||||
serverlessFunctions: data?.findManyServerlessFunctions || [],
|
||||
loading,
|
||||
error,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user