core icon indicating copy to clipboard operation
core copied to clipboard

Form is not fully robust to updating documentation and default tag in rare cases

Open kkoreilly opened this issue 1 year ago • 1 comments

Describe the bug

As discussed in #1096, there are ways to break the Form updating logic for default struct tags and field documentation.

How to reproduce

If you set the struct of a Form to a struct that is otherwise the same but has different default struct tags or different documentation, it will not update accordingly, since the default tags and documentation are only computed in an init function, which will not be called again if the name, type, and index of the field do not change. That is an exceedingly rare possibility and not worth fixing now, but we should fix it eventually; all of the doc, readOnlyTag, def, hasDef variables etc need to be recomputed every time in every relevant nested closures instead of just being computed once in an init function.

Example code

No response

Relevant output

No response

Platform

macOS

kkoreilly avatar Jul 31 '24 21:07 kkoreilly

#1389 did not fix this rare issue as discussed here: https://github.com/cogentcore/core/pull/1389#discussion_r1896472635.

kkoreilly avatar Dec 24 '24 07:12 kkoreilly