From 0b55e7cc19b7f87c6af9651719d870157b82028c Mon Sep 17 00:00:00 2001 From: "Randall C. O'Reilly" Date: Mon, 23 Dec 2024 23:19:08 -0800 Subject: [PATCH] docs update --- core/form.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/core/form.go b/core/form.go index 51fc59bb6..18b95ce8b 100644 --- a/core/form.go +++ b/core/form.go @@ -166,11 +166,10 @@ func (fm *Form) Init() { if !reflectx.Underlying(f.value).IsValid() { typnm = "invalid" } - // We must have a different name for different indexes so that the index - // is always guaranteed to be accurate, which is required since we use it - // as the ground truth everywhere. The index could otherwise become invalid, - // such as when a ShouldDisplayer condition is newly satisfied - // (see https://github.com/cogentcore/core/issues/1096). + // Using the type name ensures that widgets are specific to the type, + // even if they happen to have the same name. Using the path to index + // the structFields ensures safety against any ShouldDisplayer + // updates (see https://github.com/cogentcore/core/issues/1096). valnm := fmt.Sprintf("value-%s-%s", fieldPath, typnm) readOnlyTag := f.field.Tag.Get("edit") == "-" def, hasDef := f.field.Tag.Lookup("default")