From 9304430889d2845136c5544fbd238c2ff5e808f4 Mon Sep 17 00:00:00 2001 From: pk5ls20 Date: Mon, 14 Oct 2024 01:07:14 +0800 Subject: [PATCH] fix: deprecate the cache in constructor in NapProtoMsg --- src/core/proto/NapProto.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/core/proto/NapProto.ts b/src/core/proto/NapProto.ts index f44a1b4e..ca9d7132 100644 --- a/src/core/proto/NapProto.ts +++ b/src/core/proto/NapProto.ts @@ -117,17 +117,12 @@ export class NapProtoMsg { repeat: repeatType, }; } else if (field.kind === 'message') { - const rt = NapProtoMsgCache.get(field.type()) ?? (() => { - const msg = new NapProtoMsg(field.type()); - NapProtoMsgCache.set(field.type(), msg._proto_msg); - return msg._proto_msg; - })(); return { no: field.no, name: key, kind: 'message', repeat: field.repeat ? RepeatType.PACKED : RepeatType.NO, - T: () => rt, + T: () => new NapProtoMsg(field.type())._proto_msg, }; } }) as PartialFieldInfo[];