MCPcopy Create free account
hub / github.com/IQEngine/IQEngine / useUpdateConfig

Function useUpdateConfig

client/src/api/config/queries.ts:77–95  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

75};
76
77export const useUpdateConfig = () => {
78 let client = useQueryClient();
79
80 return useMutation({
81 mutationFn: (config: AppConfig) => {
82 return updateConfig(config);
83 },
84 onMutate: async (config: AppConfig) => {
85 await client.cancelQueries(['config']);
86 const previousConfig = client.getQueryData(['config']);
87 client.setQueryData(['config'], config);
88 return { previousConfig };
89 },
90 onError: (err, newMeta, context) => {
91 console.error('onError', err);
92 client.setQueryData(['config'], context.previousConfig);
93 },
94 });
95};
96
97interface ConnectionInfo {
98 settings: Array<{

Callers 1

ConfigurationFunction · 0.90

Calls 2

useQueryClientFunction · 0.85
updateConfigFunction · 0.85

Tested by

no test coverage detected