Merge pull request #1004 from appwrite/fix-race-condition-invalidation

fix: functions variable creation race condition invalidation
This commit is contained in:
Torsten Dittmann
2024-04-10 12:32:36 +02:00
committed by GitHub
2 changed files with 8 additions and 9 deletions
@@ -24,20 +24,17 @@
const sdkCreateVariable = async (key: string, value: string) => {
await sdk.forProject.functions.createVariable($func.$id, key, value);
await invalidate(Dependencies.VARIABLES);
await invalidate(Dependencies.FUNCTION);
await Promise.all([invalidate(Dependencies.VARIABLES), invalidate(Dependencies.FUNCTION)]);
};
const sdkUpdateVariable = async (variableId: string, key: string, value: string) => {
await sdk.forProject.functions.updateVariable($func.$id, variableId, key, value);
await invalidate(Dependencies.VARIABLES);
await invalidate(Dependencies.FUNCTION);
await Promise.all([invalidate(Dependencies.VARIABLES), invalidate(Dependencies.FUNCTION)]);
};
const sdkDeleteVariable = async (variableId: string) => {
await sdk.forProject.functions.deleteVariable($func.$id, variableId);
await invalidate(Dependencies.VARIABLES);
await invalidate(Dependencies.FUNCTION);
await Promise.all([invalidate(Dependencies.VARIABLES), invalidate(Dependencies.FUNCTION)]);
};
</script>
@@ -138,9 +138,11 @@
selectedVar = null;
showPromoteModal = false;
await invalidate(Dependencies.FUNCTION);
await invalidate(Dependencies.VARIABLES);
await invalidate(Dependencies.PROJECT_VARIABLES);
await Promise.all([
invalidate(Dependencies.FUNCTION),
invalidate(Dependencies.VARIABLES),
invalidate(Dependencies.PROJECT_VARIABLES)
]);
addNotification({
type: 'success',