From 745c60b5a66c7a3928f1cd1fab6db0730f60472f Mon Sep 17 00:00:00 2001 From: volkanceylan Date: Sun, 13 Oct 2024 22:02:46 +0300 Subject: [PATCH] Use queueMicrotask for side effect import of referenced types as it may cause issues for circular deps (noticed with swc tests) --- .../ServerTypings/ServerTypingsGenerator.Columns.cs | 2 +- .../CodeGeneration/ServerTypings/ServerTypingsGenerator.Form.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Serenity.Net.CodeGenerator/CodeGeneration/ServerTypings/ServerTypingsGenerator.Columns.cs b/src/Serenity.Net.CodeGenerator/CodeGeneration/ServerTypings/ServerTypingsGenerator.Columns.cs index f2549aa742..368e9eba41 100644 --- a/src/Serenity.Net.CodeGenerator/CodeGeneration/ServerTypings/ServerTypingsGenerator.Columns.cs +++ b/src/Serenity.Net.CodeGenerator/CodeGeneration/ServerTypings/ServerTypingsGenerator.Columns.cs @@ -103,7 +103,7 @@ private void GenerateColumns(TypeDefinition type, CustomAttribute columnsAttribu if (referencedTypeAliases.Count != 0) { sb.AppendLine(); - sb.AppendLine($"[" + string.Join(", ", referencedTypeAliases.Select(x => x.alias)) + "]; // referenced types"); + sb.AppendLine($"queueMicrotask(() => [" + string.Join(", ", referencedTypeAliases.Select(x => x.alias)) + "]); // referenced types"); } RegisterGeneratedType(codeNamespace, identifier, typeOnly: false); diff --git a/src/Serenity.Net.CodeGenerator/CodeGeneration/ServerTypings/ServerTypingsGenerator.Form.cs b/src/Serenity.Net.CodeGenerator/CodeGeneration/ServerTypings/ServerTypingsGenerator.Form.cs index 46ea60d10b..9efbc9279f 100644 --- a/src/Serenity.Net.CodeGenerator/CodeGeneration/ServerTypings/ServerTypingsGenerator.Form.cs +++ b/src/Serenity.Net.CodeGenerator/CodeGeneration/ServerTypings/ServerTypingsGenerator.Form.cs @@ -416,7 +416,7 @@ private void GenerateForm(TypeDefinition type, CustomAttribute formScriptAttribu if (referencedTypeAliases.Count != 0) { sb.AppendLine(); - sb.AppendLine($"[" + string.Join(", ", referencedTypeAliases.Select(x => x.alias)) + "]; // referenced types"); + sb.AppendLine($"queueMicrotask(() => [" + string.Join(", ", referencedTypeAliases.Select(x => x.alias)) + "]); // referenced types"); } RegisterGeneratedType(codeNamespace, identifier, typeOnly: false);