~gioverse/chat

f3d6c43bfc4ccaad1a875feb9e6ed24a6ca7916d — Jack Mordaunt 4 months ago c417df0
list: hotfix ignore direction

Fixes two silent failures:

1. list.Manager was not actually capturing the ignore direction, so it
never stopped the load requests from being sent.

2. the stateful nature of ignore direction requires both Add and Contains
to be called on a persistent stateful variable. Calling them on the
load request itself is meaningless because that value is thrown out per
iteration.

Signed-off-by: Jack Mordaunt <jackmordaunt.dev@gmail.com>
2 files changed, 2 insertions(+), 1 deletions(-)

M list/async.go
M list/manager.go
M list/async.go => list/async.go +1 -1
@@ 91,7 91,7 @@ func asyncProcess(maxSize int, hooks Hooks) (chan<- interface{}, chan viewport, 
					ignore = noDirection
				case loadRequest:
					viewport = req.viewport
					if req.Direction == ignore {
					if ignore.Contains(req.Direction) {
						continue
					}


M list/manager.go => list/manager.go +1 -0
@@ 297,6 297,7 @@ func (m *Manager) UpdatedLen(list *layout.List) int {
	// Update the state of the manager in response to any loads.
	select {
	case su := <-m.stateUpdates:
		m.ignoring = su.Ignore
		if len(m.elements.Elements) > 0 {
			// Resolve the current element at the start of the viewport within
			// the old element list.