~mariusor/motley

cb0ef59724fd70c5055606954974be2b717c4614 — Marius Orcsik a month ago 72b37a5
Renamed node loading method
2 files changed, 4 insertions(+), 4 deletions(-)

M fedbox.go
M ui.go
M fedbox.go => fedbox.go +2 -2
@@ 442,7 442,7 @@ func (m *model) loadDepsForNode(ctx context.Context, node *n) tea.Cmd {

	if node.s.Is(tree.NodeCollapsible) && len(node.c) == 0 {
		count := filters.WithMaxCount(m.height)
		if err := m.loadChildrenForNode(ctx, node, count); err != nil {
		if err := m.loadNode(ctx, node, count); err != nil {
			m.logFn("error while loading children %s", err)
			node.s |= NodeError
		}


@@ 451,7 451,7 @@ func (m *model) loadDepsForNode(ctx context.Context, node *n) tea.Cmd {
	return m.tree.stoppedLoading
}

func (m *model) loadChildrenForNode(ctx context.Context, nn *n, ff ...filters.Check) error {
func (m *model) loadNode(ctx context.Context, nn *n, ff ...filters.Check) error {
	accum := func(children *[]*n) func(ctx context.Context, col pub.CollectionInterface) error {
		return func(ctx context.Context, col pub.CollectionInterface) error {
			for _, it := range col.Collection() {

M ui.go => ui.go +2 -2
@@ 263,7 263,7 @@ func (m *model) update(msg tea.Msg) tea.Cmd {
			if parent != nil && parent.IsCollection() {
				count := filters.WithMaxCount(m.height)
				after := filters.After(filters.SameID(m.currentNode.GetLink()))
				m.loadChildrenForNode(ctx, parent, after, count)
				m.loadNode(ctx, parent, after, count)
			}
		}
	case tea.WindowSizeMsg:


@@ 376,7 376,7 @@ func (m *model) Advance(msg advanceMsg) tea.Cmd {
	newNode := node(msg.Item, withParent(&nn), withName(name))

	count := filters.WithMaxCount(m.height)
	if err := m.loadChildrenForNode(context.Background(), newNode, count); err != nil {
	if err := m.loadNode(context.Background(), newNode, count); err != nil {
		return errCmd(fmt.Errorf("unable to advance to %q: %w", nn.n, err))
	}
	if newNode.s.Is(tree.NodeCollapsible) && len(newNode.c) == 0 {