mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix(CachedManager): return updated data when cache is false (#6685)
This commit is contained in:
@@ -45,8 +45,15 @@ class CachedManager extends DataManager {
|
||||
|
||||
_add(data, cache = true, { id, extras = [] } = {}) {
|
||||
const existing = this.cache.get(id ?? data.id);
|
||||
if (cache) existing?._patch(data);
|
||||
if (existing) return existing;
|
||||
if (existing) {
|
||||
if (cache) {
|
||||
existing._patch(data);
|
||||
return existing;
|
||||
}
|
||||
const clone = existing._clone();
|
||||
clone._patch(data);
|
||||
return clone;
|
||||
}
|
||||
|
||||
const entry = this.holds ? new this.holds(this.client, data, ...extras) : data;
|
||||
if (cache) this.cache.set(id ?? entry.id, entry);
|
||||
|
||||
Reference in New Issue
Block a user