From fed6f995b5fe02ba38bb3abb7dcef43f919389c8 Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Fri, 19 May 2023 12:50:41 +0100 Subject: [PATCH] fix: update server object after updating it --- src/classes/Server.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/classes/Server.ts b/src/classes/Server.ts index a2cff7f6..e0913dc3 100644 --- a/src/classes/Server.ts +++ b/src/classes/Server.ts @@ -11,6 +11,7 @@ import { decodeTime } from "ulid"; import { ServerMember, User } from ".."; import { ServerCollection } from "../collections"; +import { hydrate } from "../hydration"; import { bitwiseAndEq, calculatePermission } from "../permissions/calculator"; import { Permission } from "../permissions/definitions"; @@ -348,7 +349,18 @@ export class Server { * @param data Changes */ async edit(data: DataEditServer) { - await this.#collection.client.api.patch(`/servers/${this.id as ""}`, data); + this.#collection.updateUnderlyingObject( + this.id, + hydrate( + "server", + await this.#collection.client.api.patch( + `/servers/${this.id as ""}`, + data + ), + this.#collection.client, + false + ) + ); } /**