You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
): value is then computed dynamically (during render time), BUT, you MUST implement Value, Children and Hidden methods, even if you don't really need them
implement go Stringer interface, which, in this case, is converted to a Leaf (see:
) . Sadly, the value is now strictly static (obtained during implementation, without the possibility of mutation during the item lifetime).
I think the Leaf struct should keep the Stringer as a property, and call its String() method during the render time, via its Value() method.
This way, it will become totally dynamic, and give the option to change its value during the item lifetime.
And if you're ok with that, i can make a pull request :)
The text was updated successfully, but these errors were encountered:
In upcoming list component, i've noticed that you can add items of any type.
There is a switch in
Tree.Child
method to handle this properly (see:lipgloss/tree/tree.go
Line 133 in 33b3263
In cases of simple custom application items, one can choose between two options:
Node
interface (see:lipgloss/tree/tree.go
Line 36 in 33b3263
Value
,Children
andHidden
methods, even if you don't really need themStringer
interface, which, in this case, is converted to aLeaf
(see:lipgloss/tree/tree.go
Line 148 in 33b3263
I think the
Leaf
struct should keep theStringer
as a property, and call itsString()
method during the render time, via itsValue()
method.This way, it will become totally dynamic, and give the option to change its value during the item lifetime.
And if you're ok with that, i can make a pull request :)
The text was updated successfully, but these errors were encountered: