From eabc82b86a84acb4a2324ec74a0cd099bda2fad0 Mon Sep 17 00:00:00 2001 From: CoderGamester Date: Sat, 30 Nov 2024 16:50:00 +0000 Subject: [PATCH] **Fix**: - *ObservableDictionary.Remove(T)* no longer sends an update if id doesn't find the element to remove it --- CHANGELOG.md | 5 +++++ Runtime/ObservableDictionary.cs | 4 +--- package.json | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c85b70..3912723 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this package will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [0.6.6] - 2024-11-30 + +**Fix**: +- *ObservableDictionary.Remove(T)* no longer sends an update if id doesn't find the element to remove it + ## [0.6.5] - 2024-11-20 **Fix**: diff --git a/Runtime/ObservableDictionary.cs b/Runtime/ObservableDictionary.cs index e3ce5fb..1375adf 100644 --- a/Runtime/ObservableDictionary.cs +++ b/Runtime/ObservableDictionary.cs @@ -266,13 +266,11 @@ public virtual void Add(TKey key, TValue value) /// public virtual bool Remove(TKey key) { - if (!Dictionary.TryGetValue(key, out var value)) + if (!Dictionary.TryGetValue(key, out var value) || !Dictionary.Remove(key)) { return false; } - Dictionary.Remove(key); - if (ObservableUpdateFlag != ObservableUpdateFlag.UpdateOnly && _keyUpdateActions.TryGetValue(key, out var actions)) { for (var i = actions.Count - 1; i > -1; i--) diff --git a/package.json b/package.json index 0740b40..8403bf3 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "com.gamelovers.dataextensions", "displayName": "Unity Data Type Extensions", "author": "Miguel Tomas", - "version": "0.6.5", + "version": "0.6.6", "unity": "2022.3", "license": "MIT", "description": "This package extends various sets of data types to be used in any type of data containers or persistent serializable data",