From 0d6f3c286a36744646e2c7ce6996f0e8a7d0f4a1 Mon Sep 17 00:00:00 2001 From: Ian Harrigan Date: Fri, 6 Sep 2024 09:53:40 +0200 Subject: [PATCH] dont allow datasources to change itemrenderer ids --- haxe/ui/core/ItemRenderer.hx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/haxe/ui/core/ItemRenderer.hx b/haxe/ui/core/ItemRenderer.hx index 2d44583de..1891055ea 100644 --- a/haxe/ui/core/ItemRenderer.hx +++ b/haxe/ui/core/ItemRenderer.hx @@ -1,6 +1,5 @@ package haxe.ui.core; -import haxe.ui.util.RTTI; import haxe.ui.components.Image; import haxe.ui.components.Label; import haxe.ui.containers.Box; @@ -10,6 +9,7 @@ import haxe.ui.events.ItemRendererEvent; import haxe.ui.events.MouseEvent; import haxe.ui.events.UIEvent; import haxe.ui.util.Color; +import haxe.ui.util.RTTI; import haxe.ui.util.StringUtil; import haxe.ui.util.TypeConverter; import haxe.ui.util.Variant; @@ -267,7 +267,10 @@ class ItemRenderer extends Box { // "data" is a special case exception here as if the item renderer contained a "data" property // it would overwrite the item renderers data property, which is, for sure, NOT // what we want to happen... ever. - if (f != "data") { + // "id" is also a special case, its bad form to start renaming ids of sub components based on the + // datasource, unexpected things can happy when your itemrenderer has an id, then, without knowing + // your datasource changes that id - its "too magic" + if (f != "data" && f != "id") { if (RTTI.hasPrimitiveClassProperty(this.className, f)) { Reflect.setProperty(this, f, v); }